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

Priority between output.externals and resolve.alias config #141

Open
Timeless0911 opened this issue Aug 29, 2024 · 0 comments
Open

Priority between output.externals and resolve.alias config #141

Timeless0911 opened this issue Aug 29, 2024 · 0 comments

Comments

@Timeless0911
Copy link
Collaborator

Timeless0911 commented Aug 29, 2024

Details

alias: {
  react: 'react-native',
},

If we want to make react alias to react-native, and the alias behaviour will affected by externals config

bundle

In bundle mode, the autoExternal is default set to true, so react will be externals to ^react($|\\/|\\\\).

So the alias config is invalid after externals set.

We should set autoExternal: false or set output.externals to make alias work

output: {
  externals: {
    react: 'react-native',
  },
},

bundleless

In bundleless mode, we use externals like below to generate bundleless output.

return callback(null, request);

So the react request is callback here, so alias config is invalid after externals set.

We need to set output.externals to make alias work, and the alias config turn out to be logic that won't be executed

output: {
  externals: {
    react: 'react-native',
  },
},
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

1 participant