mirror of
https://github.com/javascript-obfuscator/javascript-obfuscator
synced 2026-08-09 12:42:29 +00:00
70 lines
1.6 KiB
JavaScript
70 lines
1.6 KiB
JavaScript
'use strict';
|
|
|
|
const webpack = require('webpack');
|
|
const TerserPlugin = require('terser-webpack-plugin');
|
|
const packageJson = require('pjson');
|
|
|
|
const WebpackUtils = require('./utils/WebpackUtils').WebpackUtils;
|
|
|
|
module.exports = {
|
|
devtool: 'source-map',
|
|
entry: {
|
|
'index': './index.ts'
|
|
},
|
|
target: 'web',
|
|
module: {
|
|
exprContextCritical: false,
|
|
rules: [
|
|
{
|
|
test: /\.ts$/,
|
|
loader: 'ts-loader'
|
|
}
|
|
]
|
|
},
|
|
resolve: {
|
|
alias: {
|
|
assert: 'assert'
|
|
},
|
|
extensions: ['.ts', '.js']
|
|
},
|
|
plugins: [
|
|
new webpack.BannerPlugin(
|
|
{
|
|
banner: WebpackUtils.getBannerText(WebpackUtils.getLicenseText()),
|
|
raw: true,
|
|
entryOnly: false
|
|
}
|
|
),
|
|
new webpack.EnvironmentPlugin({
|
|
VERSION: packageJson.version
|
|
}),
|
|
new webpack.ProvidePlugin({
|
|
process: ['process']
|
|
})
|
|
],
|
|
optimization: {
|
|
minimizer: [
|
|
new TerserPlugin({
|
|
extractComments: false,
|
|
terserOptions: {
|
|
format: {
|
|
comments: /^!/ // Keep comments starting with !
|
|
}
|
|
}
|
|
})
|
|
]
|
|
},
|
|
output: {
|
|
libraryTarget: 'umd',
|
|
library: 'JavaScriptObfuscator',
|
|
filename: 'index.browser.js'
|
|
},
|
|
performance: {
|
|
hints: false
|
|
},
|
|
stats: {
|
|
excludeModules: true,
|
|
warnings: false
|
|
}
|
|
};
|