-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.config.js
33 lines (30 loc) · 923 Bytes
/
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
// cSpell:ignore browsersync
const webpackWpConfig = require( '@wordpress/scripts/config/webpack.config' );
const BrowserSyncPlugin = require( 'browser-sync-webpack-plugin' );
const FixStyleOnlyEntriesPlugin = require( 'webpack-fix-style-only-entries' );
const path = require( 'path' );
module.exports = {
...webpackWpConfig,
entry: {
'js/scripts': './js/scripts.js',
'css/styles': './scss/styles.scss',
},
output: {
// Change the output folder from build to dist
path: path.resolve( __dirname, 'dist' ),
filename: '[name].js',
},
plugins: [
...webpackWpConfig.plugins,
// Remove the empty JS files that webpack creates after compiling SCSS files
new FixStyleOnlyEntriesPlugin(),
// Add browsersync for automatic browser reload
new BrowserSyncPlugin( {
host: 'localhost',
port: 3000,
proxy:
process.env.PROXY_URL ??
'https://wordpress-plugin-starter.lndo.site/',
} ),
],
};