mirror of
https://github.com/FrankerFaceZ/FrankerFaceZ.git
synced 2025-08-19 12:30:54 +00:00
Add transpiling with Babel so Edge will work.
This commit is contained in:
parent
254d297f79
commit
29a4d8175e
5 changed files with 83 additions and 1 deletions
63
webpack.web.babel.js
Normal file
63
webpack.web.babel.js
Normal file
|
@ -0,0 +1,63 @@
|
|||
const merge = require('webpack-merge');
|
||||
const common = require('./webpack.web.common.js');
|
||||
|
||||
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
|
||||
const ManifestPlugin = require('webpack-manifest-plugin');
|
||||
|
||||
const config = module.exports = merge(common, {
|
||||
devtool: 'source-map',
|
||||
|
||||
module: {
|
||||
rules: [{
|
||||
test: /\.js$/,
|
||||
exclude: /node_modules/,
|
||||
loader: 'babel-loader'
|
||||
}]
|
||||
},
|
||||
|
||||
plugins: [
|
||||
new UglifyJSPlugin({
|
||||
sourceMap: true,
|
||||
uglifyOptions: {
|
||||
compress: {
|
||||
keep_fnames: true,
|
||||
keep_classnames: true
|
||||
},
|
||||
mangle: {
|
||||
keep_classnames: true,
|
||||
keep_fnames: true
|
||||
}
|
||||
}
|
||||
}),
|
||||
new ManifestPlugin({
|
||||
map: (data) => {
|
||||
if ( data.name.endsWith('.scss') )
|
||||
data.name = data.name.substr(0,data.name.length - 5) + '.css';
|
||||
|
||||
return data;
|
||||
}
|
||||
})
|
||||
],
|
||||
|
||||
output: {
|
||||
publicPath: '//cdn.frankerfacez.com/script/babel/',
|
||||
filename: '[name].[hash].js'
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// This is why we can't have nice things.
|
||||
// Why can't I just access process.env.NODE_ENV from
|
||||
// one of these files when I set it with webpack's
|
||||
// CLI? So stupid.
|
||||
//
|
||||
// So here we go.
|
||||
// This is crap.
|
||||
// But it works.
|
||||
|
||||
for(const rule of config.module.rules) {
|
||||
if ( rule.use )
|
||||
for(const use of rule.use)
|
||||
if ( use.options && use.options.name && use.options.name.startsWith('[name].') )
|
||||
use.options.name = '[name].[hash].' + use.options.name.slice(7)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue