2017-08-25 00:30:57 +00:00
|
|
|
const mix = require('laravel-mix')
|
|
|
|
const fs = require('fs')
|
2018-02-02 20:51:04 +00:00
|
|
|
const { externals, resolve, plugins } = require('./webpack.config.js')
|
2017-02-14 06:53:02 +00:00
|
|
|
|
2018-09-04 09:32:39 +00:00
|
|
|
mix.webpackConfig({
|
|
|
|
externals,
|
|
|
|
resolve,
|
|
|
|
plugins,
|
|
|
|
output: {
|
|
|
|
chunkFilename: mix.config.inProduction ? 'js/[name].[chunkhash].js' : 'js/[name].js',
|
|
|
|
publicPath: '/public/'
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
2017-10-02 21:01:05 +00:00
|
|
|
mix.setResourceRoot('./public/')
|
|
|
|
|
2017-02-14 06:53:02 +00:00
|
|
|
if (mix.config.hmr) {
|
2017-08-25 00:30:57 +00:00
|
|
|
// There's a bug with Mix/copy plugin which prevents HMR from working:
|
|
|
|
// https://github.com/JeffreyWay/laravel-mix/issues/150
|
|
|
|
console.log('In HMR mode. If assets are missing, Ctr+C and run `yarn dev` first.')
|
2017-02-14 06:53:02 +00:00
|
|
|
|
2017-08-25 00:30:57 +00:00
|
|
|
// Somehow public/hot isn't being removed by Mix. We'll handle it ourselves.
|
|
|
|
process.on('SIGINT', () => {
|
|
|
|
try {
|
|
|
|
fs.unlinkSync(mix.config.publicPath + '/hot')
|
|
|
|
} catch (e) {
|
|
|
|
}
|
|
|
|
process.exit()
|
|
|
|
})
|
2017-02-14 06:53:02 +00:00
|
|
|
} else {
|
2017-08-25 00:30:57 +00:00
|
|
|
mix.copy('resources/assets/img', 'public/img', false)
|
|
|
|
.copy('node_modules/font-awesome/fonts', 'public/fonts', false)
|
2017-02-14 06:53:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
mix.js('resources/assets/js/app.js', 'public/js')
|
2017-08-25 00:30:57 +00:00
|
|
|
.sass('resources/assets/sass/app.scss', 'public/css')
|
2017-08-27 15:53:17 +00:00
|
|
|
.js('resources/assets/js/remote/app.js', 'public/js/remote')
|
|
|
|
.sass('resources/assets/sass/remote.scss', 'public/css')
|
2017-02-14 06:53:02 +00:00
|
|
|
|
|
|
|
if (mix.config.inProduction) {
|
2017-08-25 00:30:57 +00:00
|
|
|
mix.version()
|
|
|
|
mix.disableNotifications()
|
2017-02-14 06:53:02 +00:00
|
|
|
}
|