momocow / webpack-userscript

A Webpack plugin for userscript projects. 🙈
https://cow.moe/webpack-userscript/
MIT License
202 stars 21 forks source link

Webpack Build fails after upgrade to 3.2 #100

Closed Dasug closed 1 year ago

Dasug commented 1 year ago

After upgrading to version 3.2 of webpack-userscript, the webpack build for my project fails with the following error message:

$ webpack --node-env production
[webpack-cli] Failed to load '/run/media/data-ext-ssd/user/dasug/repositories/krake-client/webpack.config.js' config
[webpack-cli] Error: Cannot find module 'class-transformer/types/storage'
Require stack:
- /run/media/data-ext-ssd/user/dasug/repositories/krake-client/node_modules/webpack-userscript/dist/features/validate-headers/utils.js
- /run/media/data-ext-ssd/user/dasug/repositories/krake-client/node_modules/webpack-userscript/dist/features/validate-headers/headers.js
- /run/media/data-ext-ssd/user/dasug/repositories/krake-client/node_modules/webpack-userscript/dist/features/validate-headers/index.js
- /run/media/data-ext-ssd/user/dasug/repositories/krake-client/node_modules/webpack-userscript/dist/features/index.js
- /run/media/data-ext-ssd/user/dasug/repositories/krake-client/node_modules/webpack-userscript/dist/plugin.js
- /run/media/data-ext-ssd/user/dasug/repositories/krake-client/node_modules/webpack-userscript/dist/index.js
- /run/media/data-ext-ssd/user/dasug/repositories/krake-client/webpack.config.js
- /run/media/data-ext-ssd/user/dasug/repositories/krake-client/node_modules/webpack-cli/lib/webpack-cli.js
- /run/media/data-ext-ssd/user/dasug/repositories/krake-client/node_modules/webpack-cli/lib/bootstrap.js
- /run/media/data-ext-ssd/user/dasug/repositories/krake-client/node_modules/webpack-cli/bin/cli.js
- /run/media/data-ext-ssd/user/dasug/repositories/krake-client/node_modules/webpack/bin/webpack.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1090:15)
    at Module._load (node:internal/modules/cjs/loader:934:27)
    at Module.require (node:internal/modules/cjs/loader:1157:19)
    at require (node:internal/modules/helpers:119:18)
    at Object.<anonymous> (/run/media/data-ext-ssd/user/dasug/repositories/krake-client/node_modules/webpack-userscript/dist/features/validate-headers/utils.js:6:19)
    at Module._compile (node:internal/modules/cjs/loader:1275:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1329:10)
    at Module.load (node:internal/modules/cjs/loader:1133:32)
    at Module._load (node:internal/modules/cjs/loader:972:12)
    at Module.require (node:internal/modules/cjs/loader:1157:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/run/media/data-ext-ssd/user/dasug/repositories/krake-client/node_modules/webpack-userscript/dist/features/validate-headers/utils.js',
    '/run/media/data-ext-ssd/user/dasug/repositories/krake-client/node_modules/webpack-userscript/dist/features/validate-headers/headers.js',
    '/run/media/data-ext-ssd/user/dasug/repositories/krake-client/node_modules/webpack-userscript/dist/features/validate-headers/index.js',
    '/run/media/data-ext-ssd/user/dasug/repositories/krake-client/node_modules/webpack-userscript/dist/features/index.js',
    '/run/media/data-ext-ssd/user/dasug/repositories/krake-client/node_modules/webpack-userscript/dist/plugin.js',
    '/run/media/data-ext-ssd/user/dasug/repositories/krake-client/node_modules/webpack-userscript/dist/index.js',
    '/run/media/data-ext-ssd/user/dasug/repositories/krake-client/webpack.config.js',
    '/run/media/data-ext-ssd/user/dasug/repositories/krake-client/node_modules/webpack-cli/lib/webpack-cli.js',
    '/run/media/data-ext-ssd/user/dasug/repositories/krake-client/node_modules/webpack-cli/lib/bootstrap.js',
    '/run/media/data-ext-ssd/user/dasug/repositories/krake-client/node_modules/webpack-cli/bin/cli.js',
    '/run/media/data-ext-ssd/user/dasug/repositories/krake-client/node_modules/webpack/bin/webpack.js'
  ]
}

This seems to be the place in the code where class-transformer/types/storage is required:

https://github.com/momocow/webpack-userscript/blob/ebcdfb6a94c07421dbc592a070c48cae44cbdf72/lib/features/validate-headers/utils.ts#L2

Downgrading webpack-userscript to version 3.1.0 makes the build work again as normal.

inazuma-bot commented 1 year ago

:tada: This issue has been resolved in version 3.2.1 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

momocow commented 1 year ago

@Dasug Thanks for reporting!

v3.2.0 has been deprecated and v3.2.1 should be used instead. 😊