-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcraco.config.js
43 lines (43 loc) · 1.57 KB
/
craco.config.js
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
const webpack = require('webpack');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const dotenv = require('dotenv').config({ path: __dirname + '/.env' })
module.exports = {
webpack: {
configure: (webpackConfig, {env, paths}) => {
return {
resolve: {
fallback: {
util: require.resolve("util/"),
stream: require.resolve("stream-browserify"),
buffer: require.resolve("buffer")
}
},
...webpackConfig,
entry: {
main: [env === 'development' &&
require.resolve('react-dev-utils/webpackHotDevClient'),paths.appIndexJs].filter(Boolean),
content: './src/chrome/content.ts',
},
plugins: [
new webpack.DefinePlugin({
'process.env': JSON.stringify(dotenv.parsed),
}),
new webpack.optimize.LimitChunkCountPlugin({
maxChunks: 1,
}),
new MiniCssExtractPlugin({
filename: 'css/[name].css',
}),
],
output: {
...webpackConfig.output,
filename: 'js/[name].js',
},
optimization: {
...webpackConfig.optimization,
runtimeChunk: false,
}
}
},
}
}