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

importType option misses some type definitions. #128

Open
mrdulin opened this issue Jul 27, 2023 · 2 comments
Open

importType option misses some type definitions. #128

mrdulin opened this issue Jul 27, 2023 · 2 comments

Comments

@mrdulin
Copy link

mrdulin commented Jul 27, 2023

Try to pass 'module' to importType option

externals: [nodeExternals({ importType: 'module' })],

Got error:

Type '"module"' is not assignable to type '"var" | "this" | "commonjs" | "amd" | "umd" | ImportTypeCallback | undefined'.ts(2322)

Below is the TS type definition of importType option

/**
 * The method in which unbundled modules will be required in the code. Best to leave as
 * 'commonjs' for node modules.
 * @default 'commonjs'
 */
importType?: 'var' | 'this' | 'commonjs' | 'amd' | 'umd' | ImportTypeCallback | undefined;

Expected:

All external types should be supported.

The above configuration works at runtime.

Version information:

"webpack": "^5.80.0",
"@types/webpack": "^5.28.1",
"webpack-node-externals": "^3.0.0"
@tobiaszpiwowarczyk
Copy link

Hello @mrdulin

The issue has been fixed in version ^3.0.1. Try do update @types/webpack-node-externals to the latest version and see if it works.

@mrdulin
Copy link
Author

mrdulin commented Sep 19, 2023

@tobiaszpiwowarczyk Thanks.

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

2 participants