fix babelconfig
parent
349488027c
commit
f7e163f7bc
|
@ -2,12 +2,11 @@
|
|||
|
||||
module.exports = function (modules) {
|
||||
const plugins = [
|
||||
// require.resolve('babel-plugin-transform-vue-jsx'),
|
||||
require.resolve('babel-plugin-transform-vue-jsx'),
|
||||
require.resolve('babel-plugin-transform-es3-member-expression-literals'),
|
||||
require.resolve('babel-plugin-transform-es3-property-literals'),
|
||||
require.resolve('babel-plugin-transform-object-assign'),
|
||||
require.resolve('babel-plugin-transform-object-rest-spread'),
|
||||
require.resolve('babel-plugin-transform-decorators-legacy'),
|
||||
]
|
||||
plugins.push([require.resolve('babel-plugin-transform-runtime'), {
|
||||
polyfill: false,
|
||||
|
|
|
@ -123,9 +123,10 @@ function compile (modules) {
|
|||
const source = [
|
||||
'components/**/*.js',
|
||||
'components/**/*.jsx',
|
||||
'!components/vc-slider/**/*', // exclude vc-slider
|
||||
]
|
||||
const tsFilesStream = babelify(gulp.src(source), modules)
|
||||
return merge2([less, tsFilesStream, assets])
|
||||
const jsFilesStream = babelify(gulp.src(source), modules)
|
||||
return merge2([less, jsFilesStream, assets])
|
||||
}
|
||||
|
||||
gulp.task('dist', (done) => {
|
||||
|
|
|
@ -2,6 +2,10 @@ const path = require('path')
|
|||
const hljs = require('highlight.js')
|
||||
const Token = require('markdown-it/lib/token')
|
||||
const cheerio = require('cheerio')
|
||||
const getBabelCommonConfig = require('./antd-tools/getBabelCommonConfig')
|
||||
const babelConfig = getBabelCommonConfig(false)
|
||||
|
||||
babelConfig.plugins.push(require.resolve('babel-plugin-syntax-dynamic-import'))
|
||||
|
||||
const fetch = (str, tag) => {
|
||||
const $ = cheerio.load(str, { decodeEntities: false, xmlMode: true })
|
||||
|
@ -124,10 +128,26 @@ module.exports = {
|
|||
{
|
||||
test: /\.vue$/,
|
||||
loader: 'vue-loader',
|
||||
options: {
|
||||
loaders: {
|
||||
js: [
|
||||
{ loader: 'babel-loader',
|
||||
options: {
|
||||
presets: ['env'],
|
||||
plugins: [
|
||||
'transform-vue-jsx',
|
||||
'transform-object-rest-spread',
|
||||
'syntax-dynamic-import',
|
||||
],
|
||||
}},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
test: /\.(js|jsx)$/,
|
||||
loader: 'babel-loader', exclude: /node_modules/,
|
||||
options: babelConfig,
|
||||
},
|
||||
{
|
||||
test: /\.(png|jpg|gif|svg)$/,
|
||||
|
|
Loading…
Reference in New Issue