const path = require('path'); const webpack = require('webpack'); module.exports = { entry: { background: 'background.js', youtube: 'youtube.js', options: [ 'options.js', 'options.html' ], }, output: { path: path.join(__dirname, 'extension', 'dist'), filename: '[name].js', publicPath: '/', }, resolve: { // This allows you to import modules just like you would in a NodeJS app. extensions: ['.js'], modules: [ path.join(__dirname, 'src'), 'node_modules', ], }, module: { rules: [{ test: /\.html$/, use: [{ loader: 'file-loader', options: { context: 'src', name: '[path][name].[ext]', }, }, { loader: 'extract-loader' }, { loader: 'html-loader', },], }] }, 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', };