-
Notifications
You must be signed in to change notification settings - Fork 22
/
webpack.mix.js
73 lines (62 loc) · 1.4 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
64
65
66
67
68
69
70
71
72
73
const glob = require('glob');
const mix = require('laravel-mix');
/**
* The webpack externals library.
*
* @type {object}
*/
const externals = {
'react': 'React',
'react-dom': 'ReactDOM',
'ko': 'ko',
'jquery': 'jQuery',
'moment': 'moment',
'lodash': 'lodash',
'popper.js': 'Popper',
'@wordpress/date': {this: ['wp', 'date']},
'@wordpress/hooks': {this: ['wp', 'hooks']},
};
/**
* File paths.
*/
const styles = glob.sync('assets/scss/*.scss');
const scripts = glob.sync('assets/babel/*.js');
const adminScripts = glob.sync('assets/babel/admin/*.js');
/**
* Styles and scripts
*/
styles.forEach(name => mix.sass(name, 'assets/css'));
scripts.forEach(name => mix.js(name, 'assets/js'));
adminScripts.forEach(name => mix.js(name, 'assets/js/admin'));
mix.react('assets/babel/calendar.jsx', 'assets/js');
if (mix.inProduction()) {
mix.version();
}
/**
* Mix Options
*
* @see https://laravel-mix.com/docs/4.0/options
*/
mix.browserSync({
proxy: process.env.MIX_BROWSER_SYNC_PROXY || 'awebooking.local',
files: ['assets/js/**/*.js', 'assets/css/*.css'],
});
mix.webpackConfig({
externals,
optimization: {
minimize: false,
},
output: {
pathinfo: false,
libraryTarget: 'this',
},
});
mix.options({
processCssUrls: false,
postCss: [
require('css-mqpacker')(),
],
});
mix.setPublicPath('./');
mix.sourceMaps(false, 'source-map');
mix.disableSuccessNotifications();