-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathwebpack.mix.js
85 lines (74 loc) · 2.14 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
// Configure these:
const sourcePath = 'resources/assets'
const publicPath = 'web'
const distPath = 'web/assets'
const mix = require('laravel-mix')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
// Extract jquery to the vendor.js file
// Feel free to add any other vendor dependencies that are rarely updated
mix.extract([
'jquery'
])
.autoload({
jquery: ['$', 'window.jQuery', "jQuery", "window.$", "jquery", "window.jquery"]
});
mix.setPublicPath(distPath);
mix
// Compile our main app entry point
.js(sourcePath + '/js/app.js', distPath + '/js')
// Compile our main app styles
.sass(sourcePath + '/sass/app.scss', distPath + '/css')
// Compile our cp styles
.sass(sourcePath + '/sass/cp.scss', distPath + '/css')
.options({
processCssUrls: false
})
// Copy over directory contents for images and fonts
.copyDirectory(sourcePath + '/images', distPath + '/images')
.copyDirectory(sourcePath + '/fonts', distPath + '/fonts')
// Make sure we babelify proper modules and create font files
mix.webpackConfig({
module: {
rules: [
{
test: /\.js?$/,
exclude: /node_modules\/(?!(foundation-sites)\/).*/,
use: [
{
loader: 'babel-loader',
options: mix.config.babel()
}
]
},
{
test: /\.font\.js/,
loader: ExtractTextPlugin.extract({
use: [
'css-loader',
'webfonts-loader'
]
})
}
]
}
})
// Create manifest file for production, sourcemaps for dev
if (mix.inProduction()) {
mix.version()
} else {
mix.sourceMaps()
}
mix.browserSync({
open: false,
proxy: 'localhost:8000',
host: 'localhost',
injectChanges: true,
logSnippet: true,
files: [
'templates/**/*.twig',
sourcePath + '/js/**/*.jsx',
distPath + '/css/app.css',
distPath + '/assets/js/**/*.js'
],
port: 80
})