我正在尝试使用异步,从零开始等待Babel 6,但我得到的再生器运行时没有定义.
.babelrc文件
{
"presets": [ "es2015", "stage-0" ]
}
Run Code Online (Sandbox Code Playgroud)
package.json文件
"devDependencies": {
"babel-core": "^6.0.20",
"babel-preset-es2015": "^6.0.15",
"babel-preset-stage-0": "^6.0.15"
}
Run Code Online (Sandbox Code Playgroud)
.js文件
"use strict";
async function foo() {
await bar();
}
function bar() { }
exports.default = foo;
Run Code Online (Sandbox Code Playgroud)
在没有async/await的情况下正常使用它可以正常工作.我有什么想法我做错了吗?
我正在经历TypeError并且不确定如何解决它。我期待您能提供的任何帮助。以下是终端输出yarn run build:
BUILD_DIR /Users/blakelucey/Desktop/fsd-next/build
SRC_DIR /Users/blakelucey/Desktop/fsd-next/src
[webpack-cli] TypeError: webpack.optimize.UglifyJsPlugin is not a constructor
at module.exports (/Users/blakelucey/Desktop/fsd-next/webpack.config.js:118:7)
at WebpackCLI.loadConfig (/Users/blakelucey/Desktop/fsd-next/node_modules/webpack-cli/lib/webpack-cli.js:1589:33)
at async WebpackCLI.resolveConfig (/Users/blakelucey/Desktop/fsd-next/node_modules/webpack-cli/lib/webpack-cli.js:1677:38)
at async WebpackCLI.createCompiler (/Users/blakelucey/Desktop/fsd-next/node_modules/webpack-cli/lib/webpack-cli.js:2085:22)
at async WebpackCLI.runWebpack (/Users/blakelucey/Desktop/fsd-next/node_modules/webpack-cli/lib/webpack-cli.js:2213:20)
at async Command.<anonymous> (/Users/blakelucey/Desktop/fsd-next/node_modules/webpack-cli/lib/webpack-cli.js:850:25)
at async Promise.all (index 1)
at async Command.<anonymous> (/Users/blakelucey/Desktop/fsd-next/node_modules/webpack-cli/lib/webpack-cli.js:1516:13)
error Command failed with exit code 2.
Run Code Online (Sandbox Code Playgroud)
这是webpack.config.js:
const webpack = require('webpack');
const path = require('path');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
// …Run Code Online (Sandbox Code Playgroud)