-
Notifications
You must be signed in to change notification settings - Fork 19
/
webpack.mix.js
executable file
·90 lines (88 loc) · 2.94 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
let mix = require('laravel-mix');
let webpack = require('webpack');
const LiveReloadPlugin = require('webpack-livereload-plugin');
/*
|--------------------------------------------------------------------------
| Mix Asset Management
|--------------------------------------------------------------------------
|
| Mix provides a clean, fluent API for defining some Webpack build steps
| for your Laravel application. By default, we are compiling the Sass
| file for the application as well as bundling up all the JS files.
|
*/
// see https://github.com/metafizzy/isotope/issues/979#issuecomment-215771272
mix.webpackConfig({
resolve: {
alias: {
'masonry': 'masonry-layout',
'isotope': 'isotope-layout'
}
},
module: {
rules: [
{
test: /isotope\-|fizzy\-ui\-utils|desandro\-|masonry|outlayer|get\-size|doc\-ready|eventie|eventemitter/,
loader: 'imports?define=>false&this=>window'
},
//bootstrap and bootbox need jQuery to be available, so make it available with the imports loader
{
test: /bootstrap.+\.(jsx|js)$/,
loader: 'imports-loader?jQuery=jquery,$=jquery,this=>window'
},
{
test: /bootbox.+\.(jsx|js)$/,
loader: 'imports-loader?jQuery=jquery,$=jquery,this=>window'
},
{
test: /\.(scss)$/,
use: [{
loader: 'style-loader', // inject CSS to page
}, {
loader: 'css-loader', // translates CSS into CommonJS modules
}, {
loader: 'postcss-loader', // Run post css actions
options: {
plugins: function () { // post css plugins, can be exported to postcss.config.js
return [
require('precss'),
require('autoprefixer')
];
}
}
}, {
loader: 'sass-loader' // compiles Sass to CSS
}]
}
]
},
plugins: [
new webpack.ProvidePlugin({
'jQuery': 'jquery',
'window.jQuery': 'jquery',
'jquery': 'jquery',
'window.jquery': 'jquery',
'$': 'jquery',
'window.$': 'jquery',
'Popper': 'popper.js',
'popper': 'popper.js',
'popper.js': 'popper.js'
}),
new LiveReloadPlugin()
]
}
)
.sass('resources/assets/sass/lara.scss', 'public/')
.sass('resources/assets/sass/surveys.scss', 'public/')
.autoload({
"jquery": ['$', 'window.jQuery', "jQuery", "window.$", "jquery", "window.jquery"],
'node_modules/popper.js/dist/umd/popper.js': ['Popper']
})
.scripts([
'node_modules/cookieconsent/build/cookieconsent.min.js'
], 'public/static.js')
.ts('resources/assets/ts/lara.ts', 'public/')
.extract(['jquery', 'bootstrap', 'bootbox', 'popper.js'])
.styles(['node_modules/cookieconsent/build/cookieconsent.min.css'], 'public/static.css')
.sourceMaps()
.version();