0

I'm trying to make some style changes to a node package I have installed using patch-package, and in order to do so I have to use webpack to compile the code in the src/ directory to get new code in dist/. When I run npx webpack I get the following error:

ERROR in ./src/index.js 189:12
Module parse failed: Unexpected token (189:12)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
|     render() {
|         return (
>             <div>

This node package worked fine out of the box, I remind you. I'm not sure what I'm missing here. The package doesn't come with any config file other than the default. Here's what's in there:

rules: [
      {
        test: /\.js$/,
        include: path.resolve(__dirname, 'src'),
        exclude: /(node_modules|bower_components|build)/,
        use: {
          loader: 'babel-loader',
          options: {
            presets: ['@babel/preset-env']
          }
        }
      },

Thanks in advance!

Edit: removing node_modules & package-lock and reinstalling does not solve the issue

Sam Bogar
  • 1
  • 1

1 Answers1

0

clean your node_modules and reinstall the packages might help.

Markstien
  • 11
  • 2
  • I've already tried this, though when I just tried again I noticed an error I haven't seen before: ``` > 3d-react-carousal@3.1.0 prepublish /home/sam/Desktop/nftlootboxv2-copy/node_modules/3d-react-carousal > if exist dist ( rmdir /s/q dist ) && npm run build sh: 1: Syntax error: "(" unexpected (expecting "then") ``` – Sam Bogar Mar 31 '21 at 02:18
  • I'm not sure what script this error is referring to, I don't see any .sh files in the directory – Sam Bogar Mar 31 '21 at 02:18