Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Webpack compilation error #2011

Open
sivadgit opened this issue Feb 26, 2022 · 11 comments
Open

Error: Webpack compilation error #2011

sivadgit opened this issue Feb 26, 2022 · 11 comments
Labels

Comments

@sivadgit
Copy link

We are using Redis cache in our Node JS Typescript Lambda API. Also we using webpack to run or build the API. While running the API we get Webpack compilation error . Please find the details below

ERROR in ./node_modules/redis/dist/index.js
Module parse failed: Unexpected token (27:4)
You may need an appropriate loader to handle this file type.
| __exportStar(require("@node-redis/time-series"), exports);

Environment:

  • Node.js Version: nodejs14.x
  • Redis Server Version: 6.2.5
  • Node Redis Version:^4.0.4
  • Platform: Windows 10
@sivadgit sivadgit added the Bug label Feb 26, 2022
@dannyk03
Copy link

dannyk03 commented Mar 5, 2022

@sivadgit you can include your webpack configuration.
Where do you run Lambda API?
Why do you have to transpile the files? 🤔

@magallegos1996
Copy link

magallegos1996 commented Jun 27, 2022

I'm facing a similar problem:
image
this is my webpack configuration:

module.exports = config => {
  return {
    ...config,
    externals: [
      {
        'aws-sdk': 'aws-sdk',
        'bufferutil': 'bufferutil',
        'utf-8-validate': 'utf-8-validate',
      },
    ],
    output: {
      ...config.output,
    },
  };
};

@leibale
Copy link
Collaborator

leibale commented Jun 28, 2022

Why are you trying to use it with webpack?

@venkateshgshetty
Copy link

I'm facing a similar problem: image this is my webpack configuration:

module.exports = config => {
  return {
    ...config,
    externals: [
      {
        'aws-sdk': 'aws-sdk',
        'bufferutil': 'bufferutil',
        'utf-8-validate': 'utf-8-validate',
      },
    ],
    output: {
      ...config.output,
    },
  };
};

Please upgrade to latest version of Webpack and try again.

@jamesliu668
Copy link

My webpack version is 4.46.0. I am facing with the same problem. Which version webpack shall I use?

@jamesliu668
Copy link

I'm facing a similar problem: image this is my webpack configuration:

module.exports = config => {
  return {
    ...config,
    externals: [
      {
        'aws-sdk': 'aws-sdk',
        'bufferutil': 'bufferutil',
        'utf-8-validate': 'utf-8-validate',
      },
    ],
    output: {
      ...config.output,
    },
  };
};

Do you solve the problem?

@xizhe-qiu
Copy link

facebook/create-react-app#9468 (comment) seems to have solved mine

@dannyk03
Copy link

node v14 does not work with the latest version of node-redis. Please use node v12 or v16.

@taemini
Copy link

taemini commented Jun 16, 2023

optional chaining is part of webpack5 (see: webpack/webpack#10227 (comment))
upgrading to webpack5 fixed for me

@daniellizik
Copy link

i can't upgrade to webpack v5 with razzle

@sbstnplcn
Copy link

Hi guys, I am facing the same problem, did you find a solution ?
Nuxt 2.17.2 with Webpack 4, Babel 7, Node 20.10.0
Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

10 participants