Support ESM applications and configs
See original GitHub issuethis package cannot be used with es modules (i.e packages that have type: module
)
in this line you are using require()
to load the custom webpack config file. if custom.webpack.config.ts is inside an es module, you must use import()
// should be replaced with `import(path)`
const customWebpackConfig = require(path);
also it has to handle webpack.config that written in typescript i.e custom.webpack.ts
you will need to pass --experimental-specifier-resolution=node
to ts-node, so it can work with .ts
I use Angular v13 and custom-webpack v13
minimal reproduction
run ng build
Issue Analytics
- State:
- Created 2 years ago
- Comments:30 (13 by maintainers)
Top Results From Across the Web
What does it take to support Node.js ESM? – The Guild
I have worked on all The Guild's libraries and graphql-js to support ESM. Here is how you can do it too.
Read more >Getting Started with (and Surviving) Node.js ESM
The Node.js ecosystem is shifting towards ESM. We examine what lies in store for application and library authors, learn some of challenges ...
Read more >Support ESM Syntax in config files · Issue #509 - GitHub
Config files need to be written in node-commonjs-style (no import ... or export const ... Change the setup so that ESM syntax is...
Read more >Use the Node.js agent with ESM - Contrast Documentation
The Contrast Node.js agent provides limited support for using ECMAScript modules (ESM) in Node.js server-side applications.
Read more >Extended Security Maintenance (ESM) - Ubuntu
Extended Security Maintenance provides ongoing Linux security fixes for Ubuntu for the Linux kernel and essential packages beyond the five-year basic ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
imports
to enable path aliasing nativelyIt is an existing feature, no need to add it, just need to support ESM.
The reasons for its existence are mostly historical. Originally
index.html
was being generated as part of the webpack build and at some point it had been separated into a stand alone process that runs after the webpack build, but still as part of thebuild-angular
builders.Since it’s performed in the same builder in Angular CLI, you can’t really separate this functionality into a separate builder.
Maybe if they switch it to multiple aggregated builders later on we’ll revise it again.
I like to think of it as a repurposing of
custom-webpack
builder. In this contextcustom-webpack
builder is not just a Custom Webpack builder, it’s more likeextended-angular-builder
, which has the functionality ofwebpack
config modification andindexTransform
.Although semantics is important I don’t think it’s a good enough reason to rename the package 😅