-
Notifications
You must be signed in to change notification settings - Fork 2
/
webpack.config.js
67 lines (56 loc) · 1.77 KB
/
webpack.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/**
* External dependencies
*/
const path = require( 'path' );
const MiniCssExtractPlugin = require( 'mini-css-extract-plugin' );
/**
* WordPress dependencies
*/
const defaultConfig = require( '@wordpress/scripts/config/webpack.config' );
module.exports = {
...defaultConfig,
entry : {
'admin' : './admin/index.js',
'front-end' : './front-end/index.js',
// todo is this needed? if so, open an issue b/c wp-scripts should detect this common pattern and support it without needing custom config
// looks like that exists now, see https://github.com/WordPress/gutenberg/pull/15982
// just need to establish a convention for naming admin/front-end
// or maybe even just auto-define based on folder names - that'd probably be better
// or cli params?
},
plugins : [
...defaultConfig.plugins,
new MiniCssExtractPlugin( {
filename : '[name].min.css',
} ),
],
/*
* Compile SCSS to vanilla CSS.
*
* @todo Remove this when https://github.com/WordPress/gutenberg/issues/14801 is resolved.
*/
module : {
...defaultConfig.module,
rules : [
...defaultConfig.module.rules,
{
test : /\.(sc|sa|c)ss$/,
exclude : [ /node_modules/ ],
use : [ MiniCssExtractPlugin.loader, 'css-loader', 'sass-loader' ],
},
],
},
output : {
...defaultConfig.output,
// @todo Can this be done via CLI param instead? If not open an issue for that and add URL here.
// IIRC there's a G issue/PR for that, and it works now. See wordcamp.org and other projects to check.
filename : '[name].min.js',
/*
* @todo Move to package.json.scripts{} when possible
* or is this needed at all? QNI doesn't use it
*
* See https://github.com/WordPress/gutenberg/issues/14891.
*/
path : path.resolve( __dirname, 'build' ),
},
};