Amaimersion / remove-files-webpack-plugin

A plugin for webpack that removes files and folders before and after compilation.
https://www.npmjs.com/package/remove-files-webpack-plugin
MIT License
51 stars 3 forks source link

Breaking change in 1.5.0 - webpack types require webpack 5 #42

Open philipp-winterle opened 2 years ago

philipp-winterle commented 2 years ago

Bug Report

Adding webpack types definition of version 5 got a problem with peer dependencies and won't work on systems using webpack 4.

Environment

Expected Behavior

Install happens without error

Actual Behavior

Install breaks because of incompatible webpack versions

Debug Log

Command failed: npm install --save-dev remove-files-webpack-plugin@1.5.0 --color=always
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: remove-files-webpack-plugin@1.5.0
npm ERR! Found: webpack@5.39.0
npm ERR! node_modules/remove-files-webpack-plugin/node_modules/webpack
npm ERR!   webpack@"^5" from @types/webpack@5.28.0
npm ERR!   node_modules/remove-files-webpack-plugin/node_modules/@types/webpack
npm ERR!     @types/webpack@"5.28.0" from remove-files-webpack-plugin@1.5.0
npm ERR!     node_modules/remove-files-webpack-plugin
npm ERR!       dev remove-files-webpack-plugin@"1.5.0" from the root project
npm ERR!   peer webpack@"^5.1.0" from terser-webpack-plugin@5.1.3
npm ERR!   node_modules/remove-files-webpack-plugin/node_modules/terser-webpack-plugin
npm ERR!     terser-webpack-plugin@"^5.1.1" from webpack@5.39.0
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer webpack@">=2.2.0" from remove-files-webpack-plugin@1.5.0
npm ERR! node_modules/remove-files-webpack-plugin
npm ERR!   dev remove-files-webpack-plugin@"1.5.0" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: webpack@5.65.0
npm ERR! node_modules/webpack
npm ERR!   peer webpack@">=2.2.0" from remove-files-webpack-plugin@1.5.0
npm ERR!   node_modules/remove-files-webpack-plugin
npm ERR!     dev remove-files-webpack-plugin@"1.5.0" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
Amaimersion commented 2 years ago

I checked it with both npm and yarn on Linux. I don't getting this error. Can you send your dependencies and devDependencies? Here is mine:

"dependencies": {
    "webpack": "^4.46.0"
  },
  "devDependencies": {
    "remove-files-webpack-plugin": "^1.5.0"
  }
philipp-winterle commented 2 years ago
"dependencies": {
    "deepmerge": "^4.2.2",
    "fs-extra": "^10.0.0",
    "mkdirp": "^1.0.4",
    "needle": "^3.0.0",
    "normalize-path": "^3.0.0",
    "puppeteer": "^10.2.0",
    "socket.io-client": "^4.4.0",
    "yargs": "^17.3.0"
  },
  "devDependencies": {
    "@babel/core": "^7.16.0",
    "@babel/plugin-transform-destructuring": "^7.16.0",
    "@babel/plugin-transform-runtime": "^7.16.4",
    "@babel/preset-env": "^7.16.4",
    "@fontsource/poppins": "^4.5.0",
    "@fortawesome/fontawesome-free": "^5.15.4",
    "@googlemaps/js-api-loader": "^1.12.11",
    "@juggle/resize-observer": "^3.3.1",
    "@popperjs/core": "^2.11.0",
    "@types/google-maps": "^3.2.3",
    "@types/markerclustererplus": "^2.1.33",
    "@zxcvbn-ts/core": "^1.0.0",
    "@zxcvbn-ts/language-common": "^1.0.0",
    "@zxcvbn-ts/language-en": "^1.0.0",
    "autocompleter": "^6.1.2",
    "autoprefixer": "^10.4.0",
    "babel-jest": "^27.4.4",
    "babel-loader": "^8.2.3",
    "bootstrap": "^5.1.3",
    "bootstrap-icons": "^1.7.2",
    "bs-toaster": "^1.0.1",
    "classlist-polyfill": "^1.2.0",
    "clean-css": "^5.2.2",
    "clean-webpack-plugin": "^3.0.0",
    "core-js": "^3.19.3",
    "css-loader": "^5.2.6",
    "cssnano": "^5.0.12",
    "cssurl": "^1.3.0",
    "dayjs": "^1.10.7",
    "deep-extend": "^0.6.0",
    "del": "^6.0.0",
    "dotenv": "^10.0.0",
    "element-closest": "^3.0.2",
    "es6-object-assign": "^1.1.0",
    "es6-promise": "^4.2.8",
    "file-loader": "^6.2.0",
    "filemanager-webpack-plugin": "^2.0.5",
    "flatpickr": "^4.6.9",
    "git-branch": "^2.0.1",
    "globby": "^11.0.3",
    "husky": "^7.0.4",
    "is-plain-object": "^5.0.0",
    "isarray": "^2.0.5",
    "jest": "^27.4.4",
    "jest-localstorage-mock": "^2.4.18",
    "jqtree": "^1.6.1",
    "jquery": "^3.6.0",
    "jquery-migrate": "^3.3.2",
    "jquery-ui-dist": "^1.12.1",
    "jquery.cookie": "^1.4.1",
    "logrocket": "^2.1.2",
    "merge-options": "^3.0.3",
    "mini-css-extract-plugin": "^1.6.0",
    "node-fetch": "^2.6.1",
    "normalize.css": "^8.0.1",
    "object-assign-deep": "^0.4.0",
    "object-fit-images": "^3.2.4",
    "optimize-css-assets-webpack-plugin": "^6.0.1",
    "postcss": "^8.4.5",
    "postcss-combine-media-query": "^1.0.1",
    "postcss-discard-empty": "^5.0.1",
    "postcss-loader": "^4.2.0",
    "postcss-nested": "^5.0.6",
    "postcss-sort-media-queries": "^3.10.11",
    "postcss-unique-selectors": "^5.0.2",
    "raf": "^3.4.1",
    "raw-loader": "^4.0.2",
    "react": "^17.0.2",
    "react-dom": "^17.0.2",
    "request": "^2.88.2",
    "request-promise": "^4.2.6",
    "sass": "^1.45.0",
    "sass-loader": "^10.1.0",
    "script-loader": "^0.7.2",
    "shariff": "^3.2.1",
    "signale": "^1.4.0",
    "simple-git": "^2.48.0",
    "sort-css-media-queries": "^1.5.4",
    "sortablejs": "^1.14.0",
    "style-loader": "^2.0.0",
    "swiper": "^6.7.0",
    "terser-webpack-plugin": "^4.2.0",
    "tinymce": "^5.10.2",
    "uuid": "^8.3.2",
    "vanilla-lazyload": "^17.5.0",
    "webpack": "^4.44.1",
    "webpack-cli": "^3.3.12",
    "webpack-manifest-plugin": "^3.1.1",
    "whatwg-fetch": "^3.6.2",
    "workbox-cacheable-response": "^6.1.5",
    "workbox-expiration": "^6.1.5",
    "workbox-precaching": "^6.1.5",
    "workbox-routing": "^6.1.5",
    "workbox-strategies": "^6.1.5",
    "workbox-webpack-plugin": "^6.1.5"
  },

I guess it is the terser plugin

Amaimersion commented 2 years ago

I'm also not getting error with your config. Same for just:

"dependencies": {
    "terser-webpack-plugin": "^5.1.3",
    "webpack": "^4.46.0"
  },
  "devDependencies": {
    "remove-files-webpack-plugin": "^1.5.0"
  }

Can you delete your package-lock.json and node_modules and reinstall everything again with npm install?

volarname commented 1 year ago

are you sure that @types/webpack should be in dependencies and not only dev dependencies??? please fix