Skip to content

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

Closed
@Timeless0911

Description

@Timeless0911

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',
  },
},

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions