serverless-bundle icon indicating copy to clipboard operation
serverless-bundle copied to clipboard

Eslint error when packaging

Open codan84 opened this issue 2 years ago • 2 comments

> npx sls package

Packaging my-project for stage dev (eu-west-1)
Bundling with Webpack...
ERROR in 
/Users/danielgruszczyk/workspace/my-project/src/handlers/test/index.js
  0:0  error  Parsing error: require() of ES Module /Users/danielgruszczyk/workspace/my-project/node_modules/eslint/node_modules/eslint-scope/lib/definition.js from /Users/danielgruszczyk/workspace/my-project/node_modules/babel-eslint/lib/require-from-eslint.js not supported.
Instead change the require of definition.js in /Users/danielgruszczyk/workspace/my-project/node_modules/babel-eslint/lib/require-from-eslint.js to a dynamic import() which is available in all CommonJS modules

✖ 1 problem (1 error, 0 warnings)


webpack compiled with 1 error
Environment: darwin, node 16.13.2, framework 3.8.0 (local), plugin 6.1.6, SDK 4.3.2
Docs:        docs.serverless.com
Support:     forum.serverless.com
Bugs:        github.com/serverless/serverless/issues

Error:
Webpack compilation error, see stats above

package.json deps:

    "serverless": "^3.8.0",
    "serverless-bundle": "^5.3.0",
    "serverless-iam-roles-per-function": "^3.2.0",
    "serverless-s3-sync": "^3.0.0"

Could be related to this.

Maybe it is time to upgrade to @babel/eslint-parser? (re https://github.com/AnomalyInnovations/serverless-bundle/blob/master/package.json#L43)

Still need to figure which one of the above is bringing eslint 8.16 but still, it is a pain to have to look for older versions of packages just to stick to eslint 7.32.

codan84 avatar May 27 '22 22:05 codan84

Did you get this bundler working with your ESM project?

alexcroox avatar Jun 25 '22 21:06 alexcroox

Having the same issue

rodrigogs avatar Nov 30 '23 00:11 rodrigogs