interview-v1/client/webpack.config.js

37 lines
904 B
JavaScript

var webpack = require('webpack');
var path = require('path');
var fs = require('fs');
var nodeModules = {};
fs.readdirSync('node_modules')
.filter(function (x) {
return ['.bin'].indexOf(x) === -1;
})
.forEach(function (mod) {
nodeModules[mod] = 'commonjs ' + mod;
});
module.exports = {
entry: './src/index.ts',
target: 'node',
output: {
filename: 'index.js',
path: path.resolve(__dirname, 'dist')
},
devtool: 'source-map',
resolve: {
// Add `.ts` and `.tsx` as a resolvable extension.
extensions: ['.ts', '.tsx', '.js']
},
module: {
rules: [
// all files with a `.ts` or `.tsx` extension will be handled by `ts-loader`
{test: /\.tsx?$/, loader: 'ts-loader'}
]
},
externals: nodeModules,
node: {
__filename: true,
__dirname: true
}
};