-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.js
38 lines (37 loc) · 1.12 KB
/
webpack.config.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
const path = require('path');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
module.exports = {
entry: {
renderer: './src/app/js/renderer.js',
login: './src/app/js/login.js',
index: './src/app/js/index.js',
pig: './src/app/js/pig.js',
shortener: './src/app/js/shortener.js'
},
output: {
filename: '[name].bundle.js',
path: path.resolve(__dirname, 'public/js'),
publicPath: '/static/js/',
},
plugins: [new MiniCssExtractPlugin({ filename: '../css/[name].bundle.css' })],
module: {
rules: [
{
test: /\.s[ac]ss$/i,
use: [
// Creates `style` nodes from JS strings
{ loader: MiniCssExtractPlugin.loader, options: { publicPath: '/static/css/' } },
// Translates CSS into CommonJS
'css-loader',
// Compiles Sass to CSS
'sass-loader',
],
},
],
},
resolve: {
extensions: ['.js'], // Allow TypeScript files to be imported without file extension - import { foo } from './bar'
},
devtool: 'source-map',
mode: process.env.NODE_ENV === 'production' ? 'production' : 'development',
};