forked from codesandbox/codesandbox-client
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.embed.js
More file actions
45 lines (42 loc) · 1.25 KB
/
webpack.embed.js
File metadata and controls
45 lines (42 loc) · 1.25 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
const merge = require('webpack-merge');
const webpack = require('webpack');
const path = require('path');
const TerserPlugin = require('terser-webpack-plugin');
const paths = require('./paths');
const commonConfig = require('./webpack.common');
module.exports = merge(
// these go first, because "react-hot-loader/patch" has to be the first entry
{
...commonConfig,
entry: {
embed: [path.join(paths.embedSrc, 'library.js')],
},
},
{
mode: 'production',
stats: 'verbose',
devtool: 'source-map',
output: {
libraryTarget: 'commonjs',
library: 'CodeSandboxEmbed',
},
externals: ['react', 'react-dom', 'styled-components'],
optimization: {
// splitChunks: {
// // include all types of chunks
// chunks: 'all',
// },
minimizer: [new TerserPlugin({ parallel: true })],
concatenateModules: true, // ModuleConcatenationPlugin
namedModules: true, // NamedModulesPlugin()
noEmitOnErrors: true, // NoEmitOnErrorsPlugin
},
plugins: [
new webpack.NormalModuleReplacementPlugin(
new RegExp('app/components/CodeEditor$'),
'app/components/CodeEditor/CodeMirror'
),
new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
],
}
);