如何在使用vue-cli设置时从babel-loader中排除特定文件?

问题描述 投票:1回答:1

transpileDependencies中有一个选项vue.config.js可以配置为来自node_modules的所有模块,应该进行转换,尽管node_modules通常被排除在外。

我正在寻找的是像对话:我有一些第三方代码,不在node_modules内,并且已经作为相当大的ES2015 UMD模块提供。 (不必要地)发现这需要相当长的时间,有时根本没有完成。因此,我想将此路径配置为从babel transpiliation中排除。目前将此模块置于node_modules下是不可取的。

那么有一种简单的方法来配置路径以免被babel-loader排除吗?

webpack babel vue-cli babel-loader
1个回答
2
投票

也许,你可以使用你的babel.config.js来忽略babel过程

const path = require('path')

module.exports = {
  presets: [],
  plugins: [],
  exclude: [
    path.resolve('file path')
  ]
}

看到那里https://babeljs.io/docs/en/options#ignore

© www.soinside.com 2019 - 2024. All rights reserved.