fluence-js/webpack.config.js
Pavel ba537c79b3
Big refactoring (#8)
Big codebase refactoring. 

* Multiple clients are allowed on the same browser instance
* Particle queue processing is split from particle handling logic
* Public AIP is completely rethought
* Updated project file structure. Clean exports for public api methods
* Additional unit tests
2021-01-19 15:47:49 +03:00

59 lines
1.3 KiB
JavaScript

const path = require('path');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const production = (process.env.NODE_ENV === 'production');
const config = {
entry: './src/index.ts',
module: {
rules: [
{
test: /\.tsx?$/,
loader: 'ts-loader',
exclude: /node_modules/
},
{
test: /\.spec\.ts$/,
use: 'mocha-loader',
exclude: /node_modules/,
},
]
},
resolve: {
extensions: [ '.tsx', '.ts', '.js']
},
output: {
filename: 'bundle.js',
path: path.resolve(__dirname, 'bundle'),
},
node: {
fs: 'empty'
},
plugins: [
new HtmlWebpackPlugin(),
new webpack.ProvidePlugin({
TextDecoder: ['text-encoding', 'TextDecoder'],
TextEncoder: ['text-encoding', 'TextEncoder']
})
]
};
if (production) {
config.mode = 'production';
} else {
config.mode = 'development';
config.devtool = 'inline-source-map';
config.devServer = {
contentBase: './bundle',
hot: false
};
config.plugins = [
...config.plugins,
new webpack.HotModuleReplacementPlugin()
];
}
module.exports = config;