生成的bundle.js跟老师的不一样

来源:20-11 构建工具 - 配置webpack

shiny_jun

2018-04-27

! function (e) {
var n = {};

function r(t) {
if (n[t]) return n[t].exports;
var o = n[t] = {
i: t,
l: !1,
exports: {}
};
return e[t].call(o.exports, o, o.exports, r), o.l = !0, o.exports
}
r.m = e, r.c = n, r.d = function (e, n, t) {
r.o(e, n) || Object.defineProperty(e, n, {
configurable: !1,
enumerable: !0,
get: t
})
}, r.r = function (e) {
Object.defineProperty(e, "__esModule", {
value: !0
})
}, r.n = function (e) {
var n = e && e.__esModule ? function () {
return e.default
} : function () {
return e
};
return r.d(n, "a", n), n
}, r.o = function (e, n) {
return Object.prototype.hasOwnProperty.call(e, n)
}, r.p = "", r(r.s = 0)
}([function (e, n) {
console.log("100")
}]);

但在运行npm start时候有这么一个提示

http://img.mukewang.com/szimg/5ae335ea0001c90311150193.jpg

然后我输入yes,生成的bundle.js文件如上。

我还试过选择no,报错如下:

http://img.mukewang.com/szimg/5ae3366200014b8909140530.jpg

写回答

2回答

Shirley99

2019-01-21

你可能还需要在webpack.config.js的module.export下设置mode: 'development',这是git里面会提示的警告内容

0
0

双越

2018-04-27

选择 yes 生成的 bundle.js 没错,你可以运行试试

0
4
双越
回复
shiny_jun
感觉有帮助,欢迎给课程一个好评,thx
2018-04-28
共4条回复

BAT大牛带你横扫初级前端JavaScript面试(第二版)

BAT高级前端工程师亲授,结合真实面试题,提高面试成功几率

4268 学习 · 817 问题

查看课程