当前,我正在研究vuetify v1.5项目。在出现“ babelHelpers未定义”错误的情况下,我的一个依赖软件包(d3-flextree)无法正常工作。 我发现的结果是:“使用transform-runtime而不是external-helpers插件”。 我的.babelrc文件是:
{
"presets": ["es2015", "stage-2"],
"plugins": [
"transform-runtime",
"transform-async-to-generator"
],
"comments": false
}
但是./node_module/d3-flextree中的.babelrc是:
{
"presets": [
[
"es2015",
{ "modules": false }
]
],
"plugins": ["external-helpers"]
}
我应该覆盖./node_module/d3-flextree/.babelrc吗?如果是,如何? 有什么webpack技巧吗?
我的package.json
"dependencies": {
"axios": "^0.19.0",
"core-js": "^2.5.3",
"d3": "^5.7.0",
"d3-flextree": "^2.1.1",
"d3-flextree-v4": "^1.0.1",
"font-awesome": "^4.6.3",
"hchs-vue-charts": "^1.2.8",
"html-loader": "^1.1.0",
"html-webpack-externals-plugin": "^3.8.0",
"html2canvas": "^1.0.0-rc.5",
"ts-loader": "^7.0.5",
"vue": "^2.5.11",
"vue-color": "^2.7.1",
"vue-grid-layout": "^2.3.8",
"vue-i18n": "^8.22.1",
"vue-input-autowidth": "^1.0.10",
"vue-quill-editor": "^3.0.6",
"vue-router": "^3.0.1",
"vue-server-renderer": "^2.6.11",
"vue-template-compiler": "^2.5.11",
"vue2-editor": "^2.10.2",
"vuedraggable": "^2.23.2",
"vuetify": "^1.5.24",
"vuex": "^3.0.1",
"vuex-router-sync": "^5.0.0"
},
"devDependencies": {
"aspnet-webpack": "^2.0.1",
"babel-core": "^6.21.0",
"babel-loader": "^6.2.10",
"babel-plugin-external-helpers": "^6.22.0",
"babel-plugin-transform-async-to-generator": "^6.22.0",
"babel-plugin-transform-runtime": "^6.15.0",
"babel-preset-es2015": "^6.18.0",
"babel-preset-stage-2": "^6.18.0",
"babel-register": "^6.18.0",
"bootstrap": "^3.4.1",
"cross-env": "^3.1.3",
"css-loader": "^0.26.4",
"event-source-polyfill": "^0.0.7",
"extract-text-webpack-plugin": "^2.0.0-rc",
"file-loader": "^0.9.0",
"jquery": "^2.2.1",
"node-sass": "^4.14.1",
"optimize-css-assets-webpack-plugin": "^1.3.1",
"sass-loader": "^4.1.0",
"style-loader": "^0.13.2",
"stylus": "^0.54.5",
"stylus-loader": "^3.0.2",
"uglifyjs-webpack-plugin": "^2.1.3",
"url-loader": "^0.5.7",
"vue-loader": "^13.6.0",
"webpack": "^2.2.0",
"webpack-hot-middleware": "^2.12.2"
}
答案 0 :(得分:0)
我找到了一个把戏。 有一个CDN file for 'd3-flextree'。只需将其复制到项目中的文件中,然后替换原始的npm软件包即可。
- import * as d3flex from "d3-flextree"
+ import * as d3flex from "../statics/scripts/d3-flextree.min"