Closed outlier89 closed 3 years ago
Got the same error .... @outlier89 do you fix that problem?
Using WP4, you need to add the following to get it to recognise .mjs
-
{
test: /\.mjs$/,
include: /node_modules/,
type: "javascript/auto"
}
Previous issues with more information are -
@jacogr Thx , thats work
Not the next release, but the release after that (i.e. scheduled for Monday after-next), the packages will move to "type": "module"
globally which means the .js
extension is used for modules and this override would become unneeded on slightly older bundlers. (This is assuming testing going 100% to plan on that, thus far it looks good, but also don't want to rush it.)
Sadly the support for all platforms with both CommonJS and ESM modules is still not as smooth as it should be, while WP5 has full support (as latest rollup, parcel, ...), not all tooling is on latest, e.g. create-react-app. The ESM has huge benefits though, i.e. the bundlers can create much smaller outputs. It has just been slightly rocky implementing...
@jacogr Works perfectly. Great going guys. Keep it up.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue if you think you have a related problem or query.
When trying to import @polkadot/api in a nuxt project, cannot complete a successful build. All 141 errors are "Can't import..." as shown below:
Expected behavior
Should build
Current behavior
Does not build
Code to reproduce for BUG REPORT
import { ApiPromise, WsProvider } from '@polkadot/api';
Environment