2018-08-10 11:53:33 +02:00
|
|
|
const path = require('path');
|
|
|
|
const webpack = require('webpack');
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
entry: {
|
2018-08-13 20:02:00 +02:00
|
|
|
background: 'background.ts',
|
|
|
|
youtube: 'youtube.ts',
|
|
|
|
options: ['options.ts', 'options.html'],
|
2018-08-10 11:53:33 +02:00
|
|
|
},
|
|
|
|
output: {
|
|
|
|
path: path.join(__dirname, 'extension', 'dist'),
|
|
|
|
filename: '[name].js',
|
2018-08-11 23:47:46 +02:00
|
|
|
publicPath: '/',
|
2018-08-10 11:53:33 +02:00
|
|
|
},
|
|
|
|
resolve: {
|
2018-08-13 20:02:00 +02:00
|
|
|
extensions: ['.js', '.ts', '.tsx'],
|
2018-08-10 11:53:33 +02:00
|
|
|
modules: [
|
|
|
|
path.join(__dirname, 'src'),
|
|
|
|
'node_modules',
|
|
|
|
],
|
|
|
|
},
|
2018-08-11 23:47:46 +02:00
|
|
|
module: {
|
|
|
|
rules: [{
|
2018-08-13 20:02:00 +02:00
|
|
|
test: /\.html$/,
|
|
|
|
use: [{
|
|
|
|
loader: 'file-loader',
|
|
|
|
options: {
|
|
|
|
context: 'src',
|
|
|
|
name: '[path][name].[ext]',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
'extract-loader',
|
|
|
|
'html-loader',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.tsx?$/,
|
|
|
|
exclude: /node_modules/,
|
|
|
|
use: {
|
|
|
|
loader: 'ts-loader',
|
2018-08-11 23:47:46 +02:00
|
|
|
},
|
2018-08-13 20:02:00 +02:00
|
|
|
},
|
|
|
|
],
|
2018-08-11 23:47:46 +02:00
|
|
|
},
|
2018-08-10 11:53:33 +02:00
|
|
|
plugins: [
|
|
|
|
// Since some NodeJS modules expect to be running in Node, it is helpful
|
|
|
|
// to set this environment var to avoid reference errors.
|
|
|
|
new webpack.DefinePlugin({
|
|
|
|
'process.env.NODE_ENV': JSON.stringify('production'),
|
|
|
|
}),
|
|
|
|
],
|
|
|
|
// This will expose source map files so that errors will point to your
|
|
|
|
// original source files instead of the transpiled files.
|
|
|
|
devtool: 'sourcemap',
|
|
|
|
};
|