koel/webpack.mix.js

46 lines
1.1 KiB
JavaScript
Raw Normal View History

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: {
2020-12-25 22:52:00 +00:00
chunkFilename: mix.inProduction() ? 'js/[name].[chunkhash].js' : 'js/[name].js',
2020-12-28 21:38:13 +00:00
publicPath: mix.inProduction() ? '/' : 'http://127.0.0.1:8080/'
2020-04-18 10:15:43 +00:00
},
devServer: {
port: 8080,
proxy: {
'/': 'http://127.0.0.1:8000/'
}
2018-09-04 09:32:39 +00:00
}
})
2020-09-12 15:01:48 +00:00
mix.setResourceRoot('./')
2017-10-02 21:01:05 +00:00
2017-02-14 06:53:02 +00:00
if (mix.config.hmr) {
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
}
2020-05-06 20:35:35 +00:00
mix.ts('resources/assets/js/app.ts', 'public/js')
2017-08-25 00:30:57 +00:00
.sass('resources/assets/sass/app.scss', 'public/css')
2020-05-06 20:35:35 +00:00
.ts('resources/assets/js/remote/app.ts', 'public/js/remote')
.sass('resources/assets/sass/remote.scss', 'public/css')
2017-02-14 06:53:02 +00:00
2020-12-25 22:52:00 +00:00
if (mix.inProduction()) {
2017-08-25 00:30:57 +00:00
mix.version()
mix.disableNotifications()
2017-02-14 06:53:02 +00:00
}