-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
74 lines (71 loc) · 2.06 KB
/
Copy pathwebpack.config.js
File metadata and controls
74 lines (71 loc) · 2.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
const path = require('path')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const WebpackManifestPlugin = require('webpack-manifest-plugin')
const webpack = require('webpack')
const IS_DEV = process.env.NODE_ENV === 'development'
let webpackConfig = {
entry: IS_DEV ? './demo/index.tsx' : './src/index.tsx',
output: {
path: path.join(__dirname, '/dist'),
filename: '[name]-[hash].js',
library: 'WorkerHooks',
libraryTarget: IS_DEV ? 'umd' : 'commonjs2',
publicPath: '/'
},
resolve: {
extensions: ['.ts', '.tsx', '.js', '.jsx']
},
devServer: {
historyApiFallback: true
},
module: {
rules: [
{
test: /\.(ts|js)x?$/,
exclude: /node_modules(?!(\/|\\)flacheql)/,
use: ['babel-loader', 'eslint-loader']
},
{
test: /\.(sa|sc|c)ss$/,
exclude: /node_modules/,
use: [
'style-loader',
'css-loader',
'postcss-loader',
'sass-loader'
].filter(x => x)
},
{
test: /svg$/,
use: [
'babel-loader',
{
loader: 'react-svg-loader',
options: {
jsx: true
}
}
]
}
]
},
plugins: [
new webpack.DefinePlugin({
__IS_DEV__: IS_DEV
}),
/*
If in development, use the HTML template to allow
developer to view code as developing.
*/
IS_DEV
? new HtmlWebpackPlugin({
template: './index.html'
})
: /*
If building for prod, create a manifest to simplify
retrieving the bundle.
*/
new WebpackManifestPlugin()
].filter(x => x)
}
module.exports = webpackConfig