magesuite / magepack

Next generation Magento 2 advanced JavaScript bundler.
Open Software License 3.0
438 stars 91 forks source link

magepack bundle - DeprecationWarning: Invalid 'main' field in '/usr/local/lib/node_modules/magepack/node_modules/generate-sourcemap/package.json' of 'generate-sourcemap.js'. Please either fix that or report it to the module author #141

Closed pmonosolo closed 2 years ago

pmonosolo commented 2 years ago

Getting an error when trying to run "magepack bundle".

This error happens at the end of the generation sequence:

ℹ Using bundling config from "/home/username/public_html/magepack.config.js". 10:18:20 ℹ Creating bundles for "pub/static/frontend/Vendor/plugin/en_US". 10:18:20 ✔ Generated bundle "common" - 972 kB (273 kB gz). 10:18:28 ✔ Generated bundle "category" - 45 kB (12 kB gz). 10:18:28 ✔ Generated bundle "cms" - 45 kB (12 kB gz). 10:18:29 ✔ Generated bundle "product" - 102 kB (32 kB gz). 10:18:29 ✔ Generated bundle "checkout" - 476 kB (113 kB gz). 10:18:31 ℹ Creating bundles for "pub/static/frontend/Magento/luma/en_US". 10:18:31 ✔ Generated bundle "common" - 972 kB (272 kB gz). 10:18:37 ✔ Generated bundle "category" - 45 kB (12 kB gz). 10:18:37 ✔ Generated bundle "cms" - 45 kB (12 kB gz). 10:18:38 ✔ Generated bundle "product" - 102 kB (32 kB gz). 10:18:38 ✔ Generated bundle "checkout" - 476 kB (113 kB gz). 10:18:40 (node:19981) [DEP0128] DeprecationWarning: Invalid 'main' field in '/usr/local/lib/node_modules/magepack/node_modules/generate-sourcemap/package.json' of 'generate-sourcemap.js'. Please either fix that or report it to the module author

any ideas what could this be?

pmonosolo commented 2 years ago

FYI:

Changed:

"main": "generate-sourcemap.js",

to

"main": "index.js",

And it worked.

{ "name": "generate-sourcemap", "version": "0.1.0", "description": "Generates a source map for files that were packed into a bundle.", "main": "index.js", "scripts": { "test": "node-trap ./test/*.js" }, "repository": { "type": "git", "url": "git://github.com/thlorenz/generate-sourcemap.git" }, "homepage": "https://github.com/thlorenz/generate-sourcemap", "dependencies": { "source-map": "~0.1.9" }, "devDependencies": {}, "keywords": [ "generate", "sourcemap", "bundle", "browser", "generate", "browserify" ], "author": { "name": "Thorsten Lorenz", "email": "thlorenz@gmx.de", "url": "http://thlorenz.com" }, "license": "MIT", "engine": { "node": ">=0.6" } }

LexKoomen commented 2 years ago

I updated my node to V16 and added this to my package.json:

"overrides": {
    "magepack": {
        "generate-sourcemap": "0.0.2"
    }
}

This will force the version of generate-sourcemap where this issue is solved. To fix to completely the dependency in this module should go to the same version.

rahulbarot commented 2 years ago

I am getting this error too, but I am not able to resolve it using the above solution. Can anyone please help? Any help would be appreciated.

LexKoomen commented 2 years ago

Hee @rahulbarot

You tried my solution? Updating node so you can use overrides en then adding the override for that specific package?

Solved my issue

rahulbarot commented 2 years ago

@pmonosolo 's solution worked for me.