2018-06-20 11:50:31 +08:00
|
|
|
const config = require('flarum-webpack-config');
|
2021-04-10 22:00:48 +08:00
|
|
|
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
|
2018-06-20 11:50:31 +08:00
|
|
|
const merge = require('webpack-merge');
|
|
|
|
|
2021-04-10 22:00:48 +08:00
|
|
|
const useBundleAnalyzer = process.env.ANALYZER === 'true';
|
|
|
|
|
|
|
|
const plugins = [];
|
|
|
|
|
|
|
|
if (useBundleAnalyzer) {
|
|
|
|
plugins.push(new BundleAnalyzerPlugin());
|
|
|
|
}
|
|
|
|
|
2018-06-20 11:50:31 +08:00
|
|
|
module.exports = merge(config(), {
|
|
|
|
output: {
|
2021-04-08 19:35:10 +08:00
|
|
|
library: 'flarum.core',
|
2018-06-20 11:50:31 +08:00
|
|
|
},
|
2020-07-03 20:47:44 +08:00
|
|
|
|
|
|
|
// temporary TS configuration
|
|
|
|
resolve: {
|
|
|
|
extensions: ['.ts', '.tsx', '.js', '.json'],
|
|
|
|
},
|
2021-04-10 22:00:48 +08:00
|
|
|
|
|
|
|
plugins,
|
2018-06-20 11:50:31 +08:00
|
|
|
});
|
2020-07-03 20:47:44 +08:00
|
|
|
|
|
|
|
module.exports['module'].rules[0].test = /\.(tsx?|js)$/;
|
|
|
|
module.exports['module'].rules[0].use.options.presets.push('@babel/preset-typescript');
|