2019-01-01 02:37:21 +03:00
|
|
|
const path = require('path');
|
2019-01-02 20:45:47 +03:00
|
|
|
const CleanWebpackPlugin = require('clean-webpack-plugin');
|
2019-01-01 02:37:21 +03:00
|
|
|
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
|
|
|
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
context: __dirname,
|
|
|
|
entry: {
|
2019-01-02 20:45:47 +03:00
|
|
|
background: './src/background/index.js',
|
|
|
|
devpanel: './src/devpanel/index.js',
|
|
|
|
devtools: './src/devtools/index.js',
|
2019-01-30 05:54:06 +03:00
|
|
|
content: './src/content/index.js',
|
2019-01-30 07:44:39 +03:00
|
|
|
inject: './src/inject/index.js'
|
2019-01-01 02:37:21 +03:00
|
|
|
},
|
2019-01-11 04:14:41 +03:00
|
|
|
mode: 'development',
|
2019-01-01 02:37:21 +03:00
|
|
|
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'] }
|
2019-01-01 02:37:21 +03:00
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.css$/,
|
2019-01-11 04:14:41 +03:00
|
|
|
use: ['style-loader', 'css-loader']
|
2019-01-03 00:36:57 +03:00
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.(png|svg|jpg|gif)$/,
|
|
|
|
use: ['file-loader']
|
2019-01-01 02:37:21 +03:00
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
2019-01-11 04:14:41 +03:00
|
|
|
resolve: { extensions: ['*', '.js', '.jsx'] },
|
2019-01-01 02:37:21 +03:00
|
|
|
output: {
|
2019-01-11 04:14:41 +03:00
|
|
|
path: path.resolve(__dirname, 'dist/'),
|
|
|
|
filename: '[name].bundle.js'
|
2019-01-01 02:37:21 +03:00
|
|
|
},
|
|
|
|
plugins: [
|
2019-01-02 20:45:47 +03:00
|
|
|
new CleanWebpackPlugin(['dist']),
|
2019-01-01 02:37:21 +03:00
|
|
|
new CopyWebpackPlugin([
|
2019-01-11 04:14:41 +03:00
|
|
|
{ from: './src/manifest.json', to: 'manifest.json' },
|
|
|
|
{ from: './res/img', to: 'img' }
|
2019-01-01 02:37:21 +03:00
|
|
|
], {}),
|
|
|
|
new HtmlWebpackPlugin({
|
2019-01-02 20:45:47 +03:00
|
|
|
template: './src/devpanel/template.html',
|
2019-01-01 02:37:21 +03:00
|
|
|
chunks: ['devpanel'],
|
|
|
|
filename: 'devpanel.html'
|
|
|
|
}),
|
|
|
|
new HtmlWebpackPlugin({
|
|
|
|
chunks: ['devtools'],
|
|
|
|
filename: 'devtools.html'
|
|
|
|
})
|
|
|
|
]
|
2019-01-11 04:14:41 +03:00
|
|
|
};
|