mirror of
https://github.com/vuejs/vue-cli.git
synced 2026-03-14 21:21:11 -05:00
28 lines
873 B
JavaScript
28 lines
873 B
JavaScript
const path = require('path')
|
|
|
|
module.exports = api => {
|
|
api.chainWebpack(webpackConfig => {
|
|
webpackConfig.module
|
|
.rule('js')
|
|
.test(/\.jsx?$/)
|
|
.include
|
|
.add(filepath => {
|
|
const nodeModules = `${path.sep}node_modules${path.sep}`
|
|
// For anything outside node_modules
|
|
if (filepath.indexOf(nodeModules) === -1) {
|
|
return true
|
|
}
|
|
// transpile webpack-dev-server client to ensure it works in older
|
|
// browsers.
|
|
// https://github.com/webpack/webpack-dev-server/pull/1241
|
|
if (filepath.indexOf(`${nodeModules}webpack-dev-server${path.sep}client`) > -1) {
|
|
return true
|
|
}
|
|
return false
|
|
})
|
|
.end()
|
|
.use('babel-loader')
|
|
.loader(require.resolve('babel-loader'))
|
|
})
|
|
}
|