模块构建失败:错误:检测到重复的插件/预设
Posted
技术标签:
【中文标题】模块构建失败:错误:检测到重复的插件/预设【英文标题】:Module build failed: Error: Duplicate plugin/preset detected 【发布时间】:2021-05-06 23:27:01 【问题描述】:我是节点包的新手,我正在尝试构建包。我花了一整天的时间找出可能是什么问题,但我无法解决。下面是我的package.json
文件。如果有人能告诉我为什么我面临重复的插件/预设错误,我将不胜感激。
package.json
"private": true,
"scripts":
"dev": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"production-noprogress": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
,
"dependencies":
"@babel/core": "^7.12.10",
"@ungap/url-search-params": "^0.1.2",
"@vimeo/player": "^2.0.1",
"axios": "^0.21.1",
"babel-plugin-syntax-dynamic-import": "^6.18.0",
"babel-polyfill": "^6.26.0",
"babel-preset-es2015": "^6.24.1",
"bootstrap": "^4.1.1",
"bootstrap-daterangepicker": "2.1.27",
"bootstrap-sass": "^3.3.7",
"bootstrap-select": "^1.13.8",
"bugsnag-sourcemap-webpack-plugin": "^0.9.7",
"countup.js": "^1.9.3",
"cross-env": "^3.2.3",
"css-loader": "^0.28.11",
"dotenv": "^5.0.1",
"eonasdan-bootstrap-datetimepicker": "^4.17.47",
"font-awesome": "^4.7.0",
"img-loader": "^2.0.0",
"intl-tel-input": "^12.1.10",
"jquery": "^3.3.1",
"jquery-toast-plugin": "^1.3.2",
"js-cookie": "^2.1.0",
"laravel-mix": "2.1.14",
"metismenu": "^2.7.8",
"modernizr": "^3.6.0",
"moment": "^2.17.1",
"moment-timezone": "^0.4.0",
"normalize.css": "^8.0.1",
"nouislider": "^10.0.0",
"numeral": "^2.0.6",
"object.entries": "^1.0.4",
"outdated-browser-rework": "^2.9.0",
"pace-progress": "^1.0.2",
"perfect-scrollbar": "0.8.1",
"popper.js": "^1.14.3",
"promise": "^7.1.1",
"scrollreveal": "3.4.0",
"slick-carousel": "1.6.0",
"sweetalert2": "^7.24.4",
"trix": "^1.0.0",
"ua-parser-js": "^0.7.20",
"underscore": "^1.8.3",
"urijs": "^1.17.0",
"v-img": "^0.2.0",
"vee-validate": "^2.1.0-beta.2",
"vue": "^2.2.4",
"vue-flatpickr-component": "^8.0.0",
"vue-infinite-scroll": "^2.0.0",
"vue-l-carousel": "^1.0.1",
"vue-loader": "^11.1.4",
"vue-multiselect": "^2.1.0",
"vue-template-compiler": "^2.2.4",
"vuex": "^3.0.1",
"weakmap-polyfill": "^2.0.0"
,
"devDependencies":
"@babel/preset-env": "^7.12.11",
"babel-core": "^6.26.3",
"babel-loader": "^8.2.2",
"less": "^3.0.1",
"less-loader": "^4.1.0"
babelrc 文件
"presets": [
[
"env",
"targets":
"browsers": [
"last 1 version",
"> 1%",
"ie >= 11"
]
]
],
"plugins": [
"syntax-dynamic-import"
]
错误
./resources/assets/js/signup_a/register.js 模块构建中的错误 失败:错误:检测到重复的插件/预设。如果您想使用 插件的两个单独实例,它们需要单独的名称,例如
插件:[ ['一些插件',], ['some-plugin', , 'some unique name'], ]
【问题讨论】:
你的 Babel 配置是什么? 我已经添加了,请查看。 你的 webpack 配置中有任何 Babel 配置吗?您的某个配置中的某些内容重复 我没明白。你能告诉我应该显示哪个文件吗? 我有 2 个文件 webpack.mix.js 和 webpack.mix.signupa.js 【参考方案1】:将您的 package.json 更新为以下内容,运行 npm install,然后运行您的命令。
"private": true,
"scripts":
"dev": "npm run development",
"development": "mix",
"watch": "mix watch",
"watch-poll": "mix watch -- --watch-options-poll=1000",
"hot": "mix watch --hot",
"prod": "npm run production",
"production": "mix --production"
,
"devDependencies":
"@babel/core": "^7.14.8",
"@babel/preset-env": "^7.14.8",
"@ungap/url-search-params": "^0.2.2",
"@vimeo/player": "^2.15.3",
"axios": "^0.21.1",
"babel-core": "^6.26.3",
"babel-loader": "^8.2.2",
"babel-plugin-syntax-dynamic-import": "^6.18.0",
"babel-polyfill": "^6.26.0",
"babel-preset-es2015": "^6.24.1",
"bootstrap": "^5.0.2",
"bootstrap-daterangepicker": "3.1.0",
"bootstrap-sass": "^3.4.1",
"bootstrap-select": "^1.13.18",
"bugsnag-sourcemap-webpack-plugin": "^0.9.8",
"countup.js": "^2.0.7",
"cross-env": "^7.0.3",
"css-loader": "^5.2.7",
"dotenv": "^10.0.0",
"eonasdan-bootstrap-datetimepicker": "^4.17.49",
"font-awesome": "^4.7.0",
"img-loader": "^4.0.0",
"intl-tel-input": "^17.0.13",
"jquery": "^3.6.0",
"jquery-toast-plugin": "^1.3.2",
"js-cookie": "^2.2.1",
"laravel-mix": "6.0.25",
"less": "^4.1.1",
"less-loader": "^10.0.1",
"metismenu": "^3.0.7",
"modernizr": "^3.11.7",
"moment": "^2.29.1",
"moment-timezone": "^0.5.33",
"normalize.css": "^8.0.1",
"nouislider": "^15.2.0",
"numeral": "^2.0.6",
"object.entries": "^1.1.4",
"outdated-browser-rework": "^3.0.1",
"pace-progress": "^1.0.2",
"perfect-scrollbar": "1.5.2",
"popper.js": "^1.14.3",
"promise": "^8.1.0",
"scrollreveal": "4.0.9",
"slick-carousel": "1.8.1",
"sweetalert2": "^11.0.19",
"trix": "^1.3.1",
"ua-parser-js": "^0.7.28",
"underscore": "^1.13.1",
"urijs": "^1.19.7",
"v-img": "^0.2.0",
"vee-validate": "^3.4.11",
"vue": "^2.6.14",
"vue-flatpickr-component": "^8.1.7",
"vue-infinite-scroll": "^2.0.2",
"vue-l-carousel": "^1.1.0",
"vue-loader": "^15.9.6",
"vue-multiselect": "^2.1.6",
"vue-template-compiler": "^2.6.14",
"vuex": "^3.6.2",
"weakmap-polyfill": "^2.0.4"
【讨论】:
以上是关于模块构建失败:错误:检测到重复的插件/预设的主要内容,如果未能解决你的问题,请参考以下文章
FCPX/AE/PR插件200+模块化LUTs电影调色预设完整版教程
Ember 服务不起作用(错误:找不到预设“es2015”)
错误:捆绑失败:错误:找不到相对于目录“C:\\Users\\...”的预设“module:metro-react-native-babel-preset”