Open
Conversation
It's not necessary to set babelrc when use babel 7
Collaborator
|
Babel 7 处理是有些不同,这个我处理一下,目前设置后遇到什么问题不? |
Author
|
多谢回复。 贴一下我的config,好多loader得自己配,不知具体为何。 webpack: {
webpackConfigList: getWebpackConfig({
target: 'web',
entry: 'app/vue/src/main.js',
plugins: {
extract: true,
imagemini: false,
},
resolve: {
extensions: ['.js', '.vue', '.json'],
alias: {
'@': path.join(__dirname , '../app/vue/src')
}
},
module: {
rules: [
{
test: /\.vue$/,
use: [
'vue-loader',
]
},
{
test:/\.css$/,
use:[
'style-loader',
'css-loader',
{
loader: 'postcss-loader',
options: {
plugins: () => [require('autoprefixer')],
}
},
'sass-loader',
]
},
{
test:/\.(png|gif|jpg|svg)$/,
use:[
'file-loader',
]
},
{
test: /\.scss$/,
use:[
'style-loader',
'css-loader',
{
loader: 'postcss-loader',
options: {
plugins: () => [require('autoprefixer')],
}
},
'sass-loader',
],
},
{
test: /\.js?$/,
exclude: /(node_modules|bower_components)/,
use: {
loader: 'babel-loader',
options: {
presets: [
'@vue/app',
],
plugins: [
'babel-plugin-espower',
'@babel/plugin-proposal-object-rest-spread',
'@babel/plugin-transform-object-assign',
'@babel/plugin-syntax-dynamic-import',
'@babel/plugin-proposal-class-properties',
'@babel/plugin-transform-runtime',
[
'component',
{
'libraryName': 'element-ui',
'styleLibraryName': 'theme-chalk'
}
]
],
comments: true
}
},
}
]
}
}),
}, |
Collaborator
|
@rushairer 这些 loader 都不用配置 |
Author
|
多谢,后来我改掉config了,忘贴上来了。 |
Author
|
如果不注释掉这行,babel 7就会报错。 |
Collaborator
|
@rushairer 我验证一下 |
Codecov Report
@@ Coverage Diff @@
## master #8 +/- ##
==========================================
Coverage ? 100.00%
==========================================
Files ? 3
Lines ? 21
Branches ? 0
==========================================
Hits ? 21
Misses ? 0
Partials ? 0
Continue to review full report at Codecov.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
It's not necessary to set babelrc when use babel 7