Mezzurite-DevTools/webpack.config.js

56 строки
1.4 KiB
JavaScript
Исходник Обычный вид История

const path = require('path');
const CleanWebpackPlugin = require('clean-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
context: __dirname,
entry: {
background: './src/background/index.js',
devpanel: './src/devpanel/index.js',
devtools: './src/devtools/index.js',
content: './src/content/index.js',
inject: './src/inject/index.js'
},
2019-01-11 04:14:41 +03:00
mode: 'development',
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /(node_modules|bower_components)/,
2019-01-11 04:14:41 +03:00
loader: 'babel-loader',
options: { presets: ['@babel/env'] }
},
{
test: /\.css$/,
2019-01-11 04:14:41 +03:00
use: ['style-loader', 'css-loader']
},
{
test: /\.(png|svg|jpg|gif)$/,
use: ['file-loader']
}
]
},
2019-01-11 04:14:41 +03:00
resolve: { extensions: ['*', '.js', '.jsx'] },
output: {
2019-01-11 04:14:41 +03:00
path: path.resolve(__dirname, 'dist/'),
filename: '[name].bundle.js'
},
plugins: [
new CleanWebpackPlugin(['dist']),
new CopyWebpackPlugin([
2019-01-11 04:14:41 +03:00
{ from: './src/manifest.json', to: 'manifest.json' },
{ from: './res/img', to: 'img' }
], {}),
new HtmlWebpackPlugin({
template: './src/devpanel/template.html',
chunks: ['devpanel'],
filename: 'devpanel.html'
}),
new HtmlWebpackPlugin({
chunks: ['devtools'],
filename: 'devtools.html'
})
]
2019-01-11 04:14:41 +03:00
};