-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathwebpack-cjs.cjs
More file actions
41 lines (39 loc) · 878 Bytes
/
webpack-cjs.cjs
File metadata and controls
41 lines (39 loc) · 878 Bytes
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
const path = require('path');
const CopyPlugin = require('copy-webpack-plugin');
const DelWebpackPlugin = require('del-webpack-plugin');
const { merge } = require('webpack-merge');
const common = require('./webpack.common.cjs');
module.exports = merge(
common.webpackSettings({
chunks: ['codec-string'],
scriptLoading: 'defer',
}),
{
output: {
enabledLibraryTypes: ['commonjs'],
path: path.resolve(__dirname, 'dist/cjs'),
library: {
type: 'commonjs',
},
filename: `[name].cjs`,
globalObject: 'this',
},
plugins: [
new CopyPlugin({
patterns: [
{
from: 'examples/*.cjs',
to({ _context, absoluteFilename }) {
return path.basename(absoluteFilename);
},
},
],
}),
new DelWebpackPlugin({
include: ['index.html', 'app.cjs'],
info: false,
keepGeneratedAssets: false,
}),
],
}
);