-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.mix.js
63 lines (56 loc) · 1.62 KB
/
webpack.mix.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
/**
* The Laravel Mix configuration for the {{Plugin Starter}} MU plugin.
*
* @link https://laravel-mix.com
*/
const mix = require('laravel-mix');
const webpack = require('webpack');
const banner = 'This file is part of the {{Plugin Starter}} MU plugin and was generated automatically';
require('laravel-mix-eslint');
// Customize Mix options.
mix.setPublicPath(process.env.MIX_BUILD_DIR || 'plugin-starter')
.options({
manifest: false,
terser: {
extractComments: false,
terserOptions: {
format: {
comments: false,
preamble: `/** ${ banner } */`,
},
},
},
postCss: [
require('postcss-preset-env'),
],
// Disable CSS rewrites.
processCssUrls: false,
});
// Customize the Webpack configuration.
mix.webpackConfig({
plugins: [
new webpack.BannerPlugin(banner),
],
externals: {
'@wordpress/element': 'wp.element',
'@wordpress/components': 'wp.components',
'@wordpress/hooks': 'wp.hooks',
'@wordpress/i18n': 'wp.i18n',
},
resolve: {
alias: {
'@stellarwp': __dirname + '/plugin-starter/vendor/stellarwp/plugin-framework',
},
},
});
/**
* Note: These may or may not be needed based on the plugin needs, but are here as an example.
*/
// Bundle CSS.
mix.css('resources/css/styles.css', 'assets/css')
.sourceMaps(false);
// Bundle JavaScript.
mix.js('resources/js/scripts.js', 'assets/js')
.sourceMaps(false)
.eslint()
.react();