forked from afcidk/HackMDir
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.dev.js
53 lines (51 loc) · 1.31 KB
/
webpack.dev.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
const path = require('path')
const webpack = require('webpack')
const ChromeExtensionReloader = require('webpack-extension-reloader')
const CopyWebpackPlugin = require('copy-webpack-plugin')
const DIST_DIR = path.resolve(__dirname, 'dist')
const SRC_DIR = path.resolve(__dirname, 'src')
module.exports = {
devtool: 'inline-source-map',
mode: 'development',
watch: true,
entry: {
background: ['babel-polyfill', SRC_DIR + '/background.js'],
content: ['babel-polyfill', SRC_DIR + '/content.js']
},
output: {
path: DIST_DIR,
filename: '[name].js',
publicPath: './',
libraryTarget: 'umd'
},
plugins: [
new ChromeExtensionReloader({
reloadPage: true,
manifest: SRC_DIR + '/manifest.json'
}),
new webpack.optimize.ModuleConcatenationPlugin(),
new CopyWebpackPlugin([
{ from: './src/manifest.json' },
{ from: './src/icons/', to: './icons' }
])
],
resolve: { extensions: ['.js', '.jsx'] },
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: ['/node_modules/', '/src/api'],
include: /src/,
use: ['babel-loader']
},
{
test: /\.(scss|sass)$/,
use: ['style-loader', 'css-loader', 'sass-loader']
},
{
test: /\.(html)$/,
use: ['html-loader']
}
]
}
}