gpt4 book ai didi

javascript - 错误: Babel polyfill is required although its already installed

转载 作者:行者123 更新时间:2023-11-27 23:23:32 24 4
gpt4 key购买 nike

在 webpack 中安装 bootstrap-loader 后,我收到此错误:

ERROR in 
For Node <= v0.12.x Babel polyfill is required.
Make sure it's installed in your 'node_modules/' directory.

@ /Users/user/~/bootstrap-loader/loader.js 1:0-44

虽然我已经安装了 babel polyfill 并包含在 webpack.config.js 中。我没有创建node_modules文件夹。

Webpack.config.js

var webpack = require('webpack');
var path = require('path');

var BUILD_DIR = path.resolve(__dirname, 'build');
var APP_DIR = path.resolve(__dirname, 'src');

module.exports = {
entry: [
// Set up an ES6-ish environment
'babel-polyfill',
'bootstrap-loader',
APP_DIR + '/import.js',
],
output: {
path: BUILD_DIR,
filename: 'bundle.js'
},
module: {
loaders: [
{
test: /\.jsx?$/,
loader: 'babel',

exclude: /node_modules/,
query: {
plugins: ['transform-runtime'],
presets: ['es2015', 'stage-0', 'react']
}
},
{
test: /\.css$/,
loader: "style-loader!css-loader"
}
]
},
plugins: [
new webpack.ProvidePlugin({
$: "jquery",
jQuery: "jquery"
})
]
};

最佳答案

我通过更新我的nodejs版本解决了这个问题。以前我有 0.10.x,我安装了 5.5.0

参见Installing Nodejs via Package-Manager关于如何安装它。

关于javascript - 错误: Babel polyfill is required although its already installed,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35176164/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com