67 lines
1.7 KiB
JavaScript
67 lines
1.7 KiB
JavaScript
|
const webpackCopy = require('copy-webpack-plugin');
|
||
|
const webpack = require('webpack');
|
||
|
const path = require('path');
|
||
|
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
|
||
|
|
||
|
const outputDirectory = 'dist';
|
||
|
|
||
|
module.exports = {
|
||
|
mode: 'development',
|
||
|
entry: {
|
||
|
bootstrap: ['./src/main.tsx'],
|
||
|
example: ['./src/example/main.tsx'],
|
||
|
example2: ['./src/example2/main.tsx']
|
||
|
},
|
||
|
output: {
|
||
|
filename: '[name].js',
|
||
|
path: path.resolve(__dirname, outputDirectory),
|
||
|
libraryTarget: 'umd',
|
||
|
globalObject: `(typeof self !== 'undefined' ? self : this)`
|
||
|
},
|
||
|
node: {
|
||
|
fs: 'empty'
|
||
|
},
|
||
|
plugins: [
|
||
|
new CleanWebpackPlugin(),
|
||
|
new webpack.DefinePlugin({
|
||
|
'typeof window': JSON.stringify('object')
|
||
|
}),
|
||
|
new webpackCopy([
|
||
|
{ from: 'stubs/index.html' },
|
||
|
{ from: 'stubs/importmap.json' },
|
||
|
{ from: './node_modules/systemjs/dist', to: 'extlib/systemjs' },
|
||
|
{ from: './node_modules/react/umd', to: 'extlib/react' },
|
||
|
{ from: './node_modules/react-dom/umd', to: 'extlib/react-dom' }
|
||
|
// { from: 'exampleApp' }
|
||
|
])
|
||
|
],
|
||
|
devtool: '#source-map',
|
||
|
//devtool: 'none',
|
||
|
resolve: {
|
||
|
modules: ['node_modules', 'src'],
|
||
|
extensions: ['.webpack.js', '.web.js', '.ts', '.tsx', '.js', '.css']
|
||
|
},
|
||
|
|
||
|
module: {
|
||
|
rules: [
|
||
|
{ parser: { system: false } },
|
||
|
{
|
||
|
test: /\.tsx?$/,
|
||
|
loader: 'awesome-typescript-loader'
|
||
|
},
|
||
|
{
|
||
|
test: /\.(jpe?g|gif|png|svg|woff|ttf|eot|wav|mp3)$/,
|
||
|
loader: 'file-loader'
|
||
|
}
|
||
|
]
|
||
|
|
||
|
},
|
||
|
externals: {
|
||
|
'react': 'react',
|
||
|
'react-dom': 'react-dom',
|
||
|
'redux': 'redux',
|
||
|
'react-redux': 'react-redux',
|
||
|
'styled-components': 'styled-components'
|
||
|
}
|
||
|
};
|