koel/webpack.mix.js

46 lines
1.1 KiB
JavaScript
Raw Normal View History

2017-08-25 01:30:57 +01:00
const mix = require('laravel-mix')
const fs = require('fs')
2018-02-02 21:51:04 +01:00
const { externals, resolve, plugins } = require('./webpack.config.js')
2017-02-14 14:53:02 +08:00
2018-09-04 16:32:39 +07:00
mix.webpackConfig({
externals,
resolve,
plugins,
output: {
2020-12-25 23:52:00 +01:00
chunkFilename: mix.inProduction() ? 'js/[name].[chunkhash].js' : 'js/[name].js',
2020-12-28 22:38:13 +01:00
publicPath: mix.inProduction() ? '/' : 'http://127.0.0.1:8080/'
2020-04-18 12:15:43 +02:00
},
devServer: {
port: 8080,
proxy: {
'/': 'http://127.0.0.1:8000/'
}
2018-09-04 16:32:39 +07:00
}
})
2020-09-12 17:01:48 +02:00
mix.setResourceRoot('./')
2017-10-02 22:01:05 +01:00
2017-02-14 14:53:02 +08:00
if (mix.config.hmr) {
2017-08-25 01:30:57 +01: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 14:53:02 +08:00
} else {
2017-08-25 01:30:57 +01:00
mix.copy('resources/assets/img', 'public/img', false)
.copy('node_modules/font-awesome/fonts', 'public/fonts', false)
2017-02-14 14:53:02 +08:00
}
2020-05-06 22:35:35 +02:00
mix.ts('resources/assets/js/app.ts', 'public/js')
2017-08-25 01:30:57 +01:00
.sass('resources/assets/sass/app.scss', 'public/css')
2020-05-06 22:35:35 +02:00
.ts('resources/assets/js/remote/app.ts', 'public/js/remote')
.sass('resources/assets/sass/remote.scss', 'public/css')
2017-02-14 14:53:02 +08:00
2020-12-25 23:52:00 +01:00
if (mix.inProduction()) {
2017-08-25 01:30:57 +01:00
mix.version()
mix.disableNotifications()
2017-02-14 14:53:02 +08:00
}