-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
54 lines (50 loc) · 1.42 KB
/
Copy pathwebpack.config.js
File metadata and controls
54 lines (50 loc) · 1.42 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
const defaultConfig = require( '@wordpress/scripts/config/webpack.config' )
const path = require( 'path' )
module.exports = {
...defaultConfig,
entry: {
// Main Cimo script.
'admin/index': path.resolve( __dirname, './src/admin/js/index.js' ),
'admin/index-styles': path.resolve( __dirname, './src/admin/css/index.css' ),
// Admin settings page script.
'admin/admin-page': path.resolve( __dirname, './src/admin/js/page/index.js' ),
'admin/admin-page-styles': path.resolve( __dirname, './src/admin/css/admin-page.css' ),
// TODO: Not currently used. Remove
// 'editor/index': path.resolve( __dirname, './src/editor/index.js' ),
// TODO: Not currently used. Remove
// 'frontend/index': path.resolve( __dirname, './src/frontend/index.js' ),
},
resolve: {
...defaultConfig.resolve,
fallback: {
...defaultConfig.resolve?.fallback,
fs: false,
path: false,
},
alias: {
...defaultConfig.resolve?.alias,
'~cimo': require( 'path' ).resolve( __dirname, 'src' ),
},
},
module: {
...defaultConfig.module,
rules: [
...defaultConfig.module.rules,
{
test: /webp-wasm\.wasm$/,
type: 'asset/resource',
generator: {
filename: 'chunks/[name]-[contenthash:8][ext]',
},
},
{
test: /node_modules[/\\]wasm-webp[/\\]dist[/\\]cjs[/\\].*\.js$/,
type: 'javascript/auto',
},
],
},
output: {
...defaultConfig.output,
chunkFilename: 'chunks/[name]-[chunkhash:8].js',
},
}