gpt4 book ai didi

webpack - 解析器 "babylon"不推荐使用的错误 - webpack 构建

转载 作者:行者123 更新时间:2023-12-04 14:53:56 35 4
gpt4 key购买 nike

在我升级我的项目 JS 包后,使用 Webpack 构建我的包时出现错误。它似乎在构建 .vue-file 时出现,并且可以出现在任何 .vue-file 构建中。我的 package.json 中没有“babylon”,我有一个更新的 @babel/core 版本 (7.2.2)。

这是错误:

{ parser: "babylon" } is deprecated; we now treat it as { parser: "babel" }

它似乎只在构建 .vue-files 时出现。

这是我的配置:

.babelrc
{
"presets": ["@babel/preset-env"],
"plugins": ["@babel/plugin-transform-regenerator"]
}

网络包配置:
module: {
rules: [
{
enforce: 'pre',
test: /\.(js|vue)$/,
loader: 'eslint-loader',
exclude: /node_modules/
},
{
test: /\.vue$/,
loader: 'vue-loader',
options: {
loaders: {
scss: 'vue-style-loader!css-loader!sass-loader',
sass: 'vue-style-loader!css-loader!sass-loader?indentedSyntax'
}
}
},
{
test: /\.js$/,
exclude: /node_modules/,
use: [ 'babel-loader' ]
},
{
test: /\.sass$/,
exclude: /node_modules/,
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: [
{
loader: 'css-loader',
options: {
sourceMap: true
}
},
{
loader: 'postcss-loader',
options: {
sourceMap: true
}
},
{
loader: 'sass-loader',
options: {
sourceMap: true
}
}
]
})
}
]

}

.eslintrc.js
  extends: [
'eslint:recommended',
'plugin:vue/recommended',
'plugin:import/errors',
'plugin:import/warnings'
],
settings: {
'import/resolver': {
'node': {
'extensions': [
'.js',
'.vue'
]
}
}
},
parserOptions: {
parser: 'babel-eslint',
ecmaVersion: 2018
}

package.json
"dependencies": {
"@fortawesome/fontawesome-free": "^5.1.0",
"@fortawesome/fontawesome-svg-core": "^1.2.10",
"@fortawesome/free-solid-svg-icons": "^5.6.1",
"@fortawesome/vue-fontawesome": "^0.1.3",
"autoprefixer": "^9.4.6",
"axios": "^0.18.0",
"babel-eslint": "^10.0.1",
"babel-polyfill": "^6.23.0",
"backbone": "^1.3.3",
"bulma": "^0.7.1",
"bulma-calendar": "^5.0.3",
"clean-webpack-plugin": "^1.0.1",
"css-loader": "^0.28.4",
"extract-text-webpack-plugin": "^3.0.0",
"flickity": "^2.0.9",
"flickity-imagesloaded": "^2.0.0",
"friendly-errors-webpack-plugin": "^1.6.1",
"glob-all": "^3.1.0",
"in-view": "^0.6.1",
"jquery": "^3.2.1",
"js-cookie": "^2.2.0",
"lazysizes": "^4.0.2",
"magnific-popup": "^1.1.0",
"node-pre-gyp": "^0.12.0",
"node-sass": "^4.7.2",
"optimize-css-assets-webpack-plugin": "^3.0.0",
"postcss-loader": "^3.0.0",
"purify-css": "^1.2.5",
"purifycss-webpack": "^0.7.0",
"sass-loader": "^6.0.7",
"style-loader": "^0.18.2",
"underscore": "^1.8.3",
"vue": "2.5.22",
"vue-affix": "^0.2.4",
"vue-lazyload": "^1.2.6",
"vue-loader": "13.7.2",
"vue-template-compiler": "2.5.22",
"vuex": "^3.0.1",
"webpack": "^3.4.1",
"webpack-bundle-analyzer": "^2.8.3",
"webpack-bundle-tracker": "^0.2.0",
"webpack-dev-server": "^2.6.1",
"webpack-merge": "^4.1.0"
},
"devDependencies": {
"@babel/core": "^7.2.2",
"@babel/plugin-transform-regenerator": "^7.0.0",
"@babel/preset-env": "^7.3.1",
"babel-loader": "^8.0.5",
"eslint": "^4.14.0",
"eslint-loader": "^2.1.1",
"eslint-plugin-import": "^2.14.0",
"eslint-plugin-vue": "4.7.1"
}

最佳答案

问题来自 vue-loader 13.x.x 和 14.x.x
版本 15.x.x 似乎没问题,但我无法在不破坏所有内容的情况下将我的项目更新到 15.x.x。 (我猜你会有同样的问题)
我会在项目仓库中记录一个问题,幸运的是他们会发布一个修复程序。
编辑:
目前,您可以使用我创建的 14.2.2 的 fork 版本来摆脱该消息。不确定它是否与您的构建兼容。
尝试更换:

"vue-loader": "13.7.2",
"vue-loader": "https://github.com/graux/vue-loader#a0d6b77",

关于webpack - 解析器 "babylon"不推荐使用的错误 - webpack 构建,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54306758/

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