-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.js
91 lines (90 loc) · 2.2 KB
/
webpack.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
const path = require('path');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin');
const CopyPlugin = require('copy-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const GenerateJsonPlugin = require('generate-json-webpack-plugin');
module.exports = {
entry: {
content: './src/content/index.js',
},
output: {
filename: 'bundles/[name].js',
path: path.join(__dirname, 'build'),
},
resolve: {
extensions: ['.js', '.json'],
modules: ['node_modules', './src'],
},
devtool: 'inline-source-map',
mode: 'development',
module: {
rules: [
{
test: /\.m?js/,
resolve: {
fullySpecified: false,
},
},
{
test: /\.font\.js/,
use: [
'style-loader',
'css-loader',
{
loader: 'webfonts-loader',
options: { embed: true },
},
],
},
{
test: /\.css$/,
use: ['style-loader', 'css-loader'],
},
{
test: /\.(js)?$|\.(jsx)?$/,
include: [path.join(__dirname, 'src')],
loader: 'babel-loader',
},
{
test: /\.jpe?g$|\.gif$|\.png$|\.ttf$|\.eot$|\.svg$/,
use: [
{
loader: 'file-loader',
options: {
name: '[name].[ext]?[hash]',
outputPath: 'assets',
publicPath: 'assets',
},
},
],
},
{
// polyfill process into sentence-splitter module to work in the browser
test: /node_modules\/sentence-splitter\/lib\/(.*)\.js/,
use: [
{
loader: 'imports-loader',
options: {
type: 'commonjs',
imports: ['single process/browser process'],
},
},
],
},
],
},
plugins: [
new CaseSensitivePathsPlugin(),
new CleanWebpackPlugin(),
new CopyPlugin({
patterns: [
{
from: './public',
to: path.join(__dirname, 'build'),
},
],
}),
new GenerateJsonPlugin('manifest.json', require('./manifest')),
],
};