-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.server.js
54 lines (53 loc) · 1.47 KB
/
webpack.server.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
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const common = require('./webpack.common.js');
module.exports = {
mode: 'development',
devtool: 'inline-source-map',
entry: {
server: './examples/dev-server.js',
},
output: {
filename: 'dev-server.bundle.js',
path: path.resolve(__dirname, 'examples'),
},
module: {
rules: [
// 不建议加载测试css(index.css), 体验不好
// {
// test: /\.css$/i,
// use: ['style-loader', 'css-loader'],
// },
{
test: /\.s[ac]ss$/i,
use: [
// 将 JS 字符串生成为 style 节点
'style-loader',
// 将 CSS 转化成 CommonJS 模块
'css-loader',
// 将 Sass 编译成 CSS
'sass-loader',
],
},
],
},
devServer: {
static: [
{
directory: path.join(__dirname, './examples'),
publicPath: '/',
},
// {
// directory: path.join(__dirname, './dist/ohoTips/css'),
// publicPath: '/dist/ohoTips/css',
// },
],
hot: true,
},
plugins: [
new HtmlWebpackPlugin({
title: 'Tips 插件 热启动',
template: 'examples/index.html'
}),
],
};