小编Kar*_*sch的帖子

如何使用 Webpack 为 Babel 包含节点模块

跑步时

npm run build
Run Code Online (Sandbox Code Playgroud)

我遇到了来自 uglify 的与 es6 相关的语法错误,所以我猜 babel 没有正确处理节点模块(秒到分钟)。

我的 .babelrc

{
  "presets": ["es2015", "stage-0"],
  "plugins": ["transform-runtime"],
  "comments": false,
  "env": {
    "test": {
      "plugins": [ "istanbul" ]
    }
  }
}
Run Code Online (Sandbox Code Playgroud)

我的 Webpack 配置:

var path = require('path')
var config = require('../config')
var utils = require('./utils')
var projectRoot = path.resolve(__dirname, '../')

var env = process.env.NODE_ENV
// check env & config/index.js to decide whether to enable CSS source maps for the
// various preprocessor loaders added to vue-loader at the …
Run Code Online (Sandbox Code Playgroud)

npm uglifyjs ecmascript-6 webpack babeljs

4
推荐指数
2
解决办法
1万
查看次数

标签 统计

babeljs ×1

ecmascript-6 ×1

npm ×1

uglifyjs ×1

webpack ×1