SponsorBlock/webpack/webpack.common.js

50 lines
1.3 KiB
JavaScript
Raw Normal View History

2020-01-29 04:16:48 +01:00
const webpack = require("webpack");
const path = require('path');
const CopyPlugin = require('copy-webpack-plugin');
2020-02-04 07:32:58 +01:00
const BuildManifest = require('./webpack.manifest');
2020-01-29 04:16:48 +01:00
const srcDir = '../src/';
2020-02-04 07:32:58 +01:00
module.exports = env => ({
2020-01-29 04:16:48 +01:00
entry: {
popup: path.join(__dirname, srcDir + 'popup.ts'),
background: path.join(__dirname, srcDir + 'background.ts'),
2020-02-04 04:34:43 +01:00
content: path.join(__dirname, srcDir + 'content.ts'),
options: path.join(__dirname, srcDir + 'options.ts')
2020-01-29 04:16:48 +01:00
},
output: {
path: path.join(__dirname, '../dist/js'),
filename: '[name].js'
},
optimization: {
splitChunks: {
name: 'vendor',
chunks: "initial"
}
},
module: {
rules: [
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/
}
]
},
resolve: {
extensions: ['.ts', '.tsx', '.js']
},
plugins: [
// exclude locale files in moment
new CopyPlugin([
2020-02-04 07:32:58 +01:00
{ from: '.', to: '../', ignore: ['manifest.json'] }
2020-01-29 04:16:48 +01:00
],
{context: 'public' }
),
2020-02-04 07:32:58 +01:00
new BuildManifest({
browser: env.browser,
2020-02-20 17:39:06 +01:00
pretty: env.mode === "production",
stream: env.stream
2020-02-04 07:32:58 +01:00
})
2020-01-29 04:16:48 +01:00
]
2020-02-04 07:32:58 +01:00
});