mirror of
https://github.com/captbaritone/webamp
synced 2024-11-23 00:34:42 +00:00
8876e36658
Work around for https://github.com/mishoo/UglifyJS2/issues/2842
65 lines
1.3 KiB
JavaScript
65 lines
1.3 KiB
JavaScript
const path = require("path");
|
|
const webpack = require("webpack");
|
|
const UglifyJsPlugin = require("uglifyjs-webpack-plugin");
|
|
|
|
module.exports = {
|
|
module: {
|
|
rules: [
|
|
{
|
|
test: /\.css$/,
|
|
use: ["style-loader", "css-loader"]
|
|
},
|
|
{
|
|
test: /\.js$/,
|
|
exclude: /(node_modules)/,
|
|
use: {
|
|
loader: "babel-loader",
|
|
options: {
|
|
forceEnv: "library"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
test: /\.(wsz|mp3)$/,
|
|
use: [
|
|
{
|
|
loader: "file-loader",
|
|
options: {
|
|
emitFile: true,
|
|
name: "[path][name]-[hash].[ext]"
|
|
}
|
|
}
|
|
]
|
|
}
|
|
],
|
|
noParse: [/jszip\.js$/]
|
|
},
|
|
plugins: [
|
|
new webpack.DefinePlugin({
|
|
"process.env": {
|
|
NODE_ENV: JSON.stringify("production")
|
|
}
|
|
}),
|
|
new UglifyJsPlugin({
|
|
include: /\.min\.js$/,
|
|
parallel: true,
|
|
uglifyOptions: {
|
|
compress: {
|
|
// Workaround: https://github.com/mishoo/UglifyJS2/issues/2842
|
|
inline: false
|
|
}
|
|
}
|
|
})
|
|
],
|
|
entry: {
|
|
bundle: "./js/webamp.js",
|
|
"bundle.min": "./js/webamp.js"
|
|
},
|
|
output: {
|
|
path: path.resolve(__dirname, "../built"),
|
|
filename: "webamp.[name].js",
|
|
library: "Webamp",
|
|
libraryTarget: "umd"
|
|
}
|
|
};
|