Skip to content

Commit 3b2d8cd

Browse files
committed
fix(source-map): 使用 webpack-encoding-plugin 修复注释中的中文乱码
1 parent 49c3e28 commit 3b2d8cd

File tree

3 files changed

+5
-0
lines changed

3 files changed

+5
-0
lines changed

lib/commands/server.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ var connect = require('connect'),
1818
var Manager = require('../modules/manager.js');
1919
var UtilFs = require('../utils/fs.js');
2020
var UtilPath = require('../utils/path.js');
21+
var EncodingPlugin = require('webpack-encoding-plugin');
2122

2223
exports.usage = '开发服务';
2324
exports.abbr = 's';
@@ -262,6 +263,7 @@ exports.run = function (options) {
262263

263264
nextConfig.plugins.push(require('../plugins/progressBarPlugin.js'));
264265
nextConfig.plugins.push(require('../plugins/compileInfoPlugin.js'));
266+
nextConfig.plugins.push(new EncodingPlugin({ encoding: 'utf-8' }));
265267

266268
return nextConfig;
267269
});

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
"uglifycss": "0.0.25",
5858
"webpack": "1.14.0",
5959
"webpack-dev-middleware": "1.9.0",
60+
"webpack-encoding-plugin": "^0.2.1"
6061
},
6162
"repository": {
6263
"type": "http",

src/commands/server.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ const connect = require('connect'),
1414
const Manager = require('../modules/manager.js');
1515
const UtilFs = require('../utils/fs.js');
1616
const UtilPath = require('../utils/path.js');
17+
const EncodingPlugin = require('webpack-encoding-plugin');
1718

1819
exports.usage = '开发服务';
1920
exports.abbr = 's';
@@ -254,6 +255,7 @@ exports.run = (options) => {
254255

255256
nextConfig.plugins.push(require('../plugins/progressBarPlugin.js'));
256257
nextConfig.plugins.push(require('../plugins/compileInfoPlugin.js'));
258+
nextConfig.plugins.push(new EncodingPlugin({encoding: 'utf-8'}));
257259

258260
return nextConfig;
259261
});

0 commit comments

Comments
 (0)