This repository has been archived by the owner on Jan 29, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathwebpack.dev.js
56 lines (53 loc) · 1.51 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
54
55
56
const path = require('path')
const fs = require('fs')
const merge = require('webpack-merge')
const { HotModuleReplacementPlugin, DefinePlugin } = require('webpack')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const GitRevisionPlugin = require('git-revision-webpack-plugin')
const baseConfig = require('./webpack.base')
const devServerConfig = require('./configs/devServer.config')
const gitRevisionPlugin = new GitRevisionPlugin()
module.exports = merge(baseConfig, {
mode: 'development',
devtool: 'inline-source-map',
output: {
filename: '[name].bundle.js',
publicPath: '/',
path: path.resolve(__dirname, 'dist'),
},
devServer: devServerConfig,
module: {
rules: [
{
test: /\.scss$/,
use: [
'style-loader',
{
loader: 'css-loader',
options: { importLoaders: 1 },
},
{
loader: 'sass-loader',
options: {
includePaths: [path.resolve(__dirname, 'src/styles')],
data: '@import "./src/styles/_variables.scss";',
},
},
],
},
],
},
plugins: [
new HtmlWebpackPlugin({
title: 'dev',
template: path.resolve(__dirname, 'static/index.html'),
inject: true,
origin: `http://localhost:8888/`,
}),
new DefinePlugin({
DEV: true,
'process.env.version': JSON.stringify(gitRevisionPlugin.commithash().slice(0, 7)), // TODO: delete when real
}),
new HotModuleReplacementPlugin(),
],
})