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

Uncaught Error: ES Modules may not assign module.exports or exports.*, Use ESM export syntax, instead #89

Open
chiptus opened this issue Oct 26, 2021 · 2 comments

Comments

@chiptus
Copy link

chiptus commented Oct 26, 2021

I get this error Uncaught Error: ES Modules may not assign module.exports or exports.*, Use ESM export syntax, instead on html templates.

ref:

changing https://github.com/WearyMonkey/ngtemplate-loader/blob/master/index.js#L62 to export default ... fixes the issue. but then the auto-ngtemplate-loader needs to do require(...).default

@arditdaku
Copy link

Hi there, I get the same error when I deploy my app through pm2, I check the two closed issues that are mentioned.
Here is my babel.config.js and my webpack.config.js

babel.config.js

module.exports = {
  sourceType: "unambiguous",
  plugins: [
    [
      "module-resolver",
      {
        alias: {
          "#root": "./src",
        },
      },
    ],
  ],
  presets: [
    [
      "@babel/preset-env",
      {
        targets: {
          node: "current",
        },
      },
    ],
  ],
};


webpack.config.js

const path = require("path");
const webpackNodeExternals = require("webpack-node-externals");

module.exports = {
  entry: "./src/index.js",
  externals: [webpackNodeExternals()],
  mode: "production",
  module: {
    rules: [
      {
        test: /\.js$/,
        use: "babel-loader",
      },
    ],
  },
  output: {
    filename: "bundle.js",
    path: path.resolve(__dirname, "./dist"),
  },
  target: "node",
};
`


and my ecosystem.config.js

module.exports = {
  apps: [
    {
      name: "api-gateway",
      script: "dist/bundle.js",
      log: "process.log",
      autorestart: true,
      env: {
        PORT: 80,
        NODE_ENV: "production",
      },
    },
  ],
};

@marcos-castrillo
Copy link

+1, I'm still having the same issue

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

No branches or pull requests

3 participants