rage-framework-rpc/webpack.config.js

38 lines
931 B
JavaScript
Raw Normal View History

2018-11-02 05:10:24 +00:00
const path = require('path');
2019-02-03 01:46:00 +00:00
const ReplaceInFileWebpackPlugin = require('replace-in-file-webpack-plugin');
const LIBRARY_NAME = 'rpc';
const OUTPUT_FILE = 'rage-rpc.min.js';
2018-11-02 05:10:24 +00:00
module.exports = {
2019-01-10 23:57:44 +00:00
entry: './src/index.ts',
2018-11-02 05:10:24 +00:00
mode: 'production',
2019-01-10 23:57:44 +00:00
module: {
rules: [
{
test: /\.ts$/,
loader: 'babel-loader'
}
]
},
resolve: {
extensions: ['.ts']
},
2018-11-02 05:10:24 +00:00
output: {
path: path.resolve(__dirname, 'dist'),
2019-02-03 01:46:00 +00:00
filename: OUTPUT_FILE,
library: LIBRARY_NAME,
2018-11-02 05:29:47 +00:00
libraryTarget: 'umd',
globalObject: "typeof self !== 'undefined' ? self : this"
2019-02-03 01:46:00 +00:00
},
plugins: [
new ReplaceInFileWebpackPlugin([{
dir: 'dist',
files: [OUTPUT_FILE],
rules: [{
search: `exports.${LIBRARY_NAME}`,
replace: 'exports'
}]
}])
]
2018-11-02 05:10:24 +00:00
};