I working with Angualar 11 project using webpack. The project running on OpenShift. It uses webpack 4.44.2 version, node 12 version. The project suddenly on build phase throw an error
[2021-09-21T14:59:36.679Z] Can't import the named export 'URL' from non EcmaScript module (only default export is available)
My webpack config file is:
const path = require("path");
const { NODE_ENV = "production" } = process.env;
module.exports = {
entry: "./server",
mode: NODE_ENV,
target: "node",
output: {
path: path.resolve(__dirname, "dist"),
filename: "server.js",
},
resolve: {
extensions: [".ts", ".js"],
},
};
in my package.json file the build command is :
"build:server": "webpack --config=./webpack-server.config.js"