-
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathwebpack.mix.js
51 lines (44 loc) · 1.16 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
const fs = require('fs');
const mix = require('laravel-mix');
const { config } = require('./webpack.mix.config');
mix
/**
* JavaScript
*/
.js('assets/js/app.js', 'build/js')
/**
* SASS
*/
.sass('assets/sass/styles.scss', 'css/', config.sass)
.sass('assets/sass/mobile.scss', 'css/', config.sass)
/**
* Copy files
*/
// .copy('assets/css/**', 'build/css')
// .copyDirectory('assets/fonts', 'build/fonts')
.copyDirectory('assets/img', 'build/img')
.copyDirectory('assets/favicons', 'build/favicons')
// The path for mix-manifest.json
.setPublicPath('build')
.version([])
.options(config.mix)
.webpackConfig({ ...config.webpack, ...{ devtool: false } })
/**
* Copy manifest file to _data folder to make it available as global data that
* can be used in an eleventy filter.
*/
.then(() => {
fs.copyFile('build/mix-manifest.json', '_data/mixManifest.json', err => {
if (err) throw err;
});
});
/**
* Sourcemaps
*
* In dev, sourcemaps are inlined into the files directly.
*
* @link https://github.com/JeffreyWay/laravel-mix/issues/879#issuecomment-354152991
*/
if (!mix.inProduction()) {
mix.webpackConfig(config.webpack).sourceMaps();
}