Skip to content

Why is 'externals' needed in webpack.config.js? #14

Open
@46319943

Description

@46319943

When I use ES6 for development, I ran into this problem:
Esri/arcgis-webpack-plugin#11 (comment)

By setting externals in webpack.config.js, I successfully solved the problem.

externals: [
    (context, request, callback) => {
      if (/pe-wasm$/.test(request)) {
        return callback(null, "amd " + request);
      }
      callback();
    }
  ],

I know that the purpose of this code is to introduce external modules in the form of AMD modules at runtime.
But why do we need to set this item? In the official example, there is no externals setting in the configuration file. How is this going?

Even if I don't use babel and don't set externals, there will be problems. In the official vue example, it uses babel to compile the ts file without setting externals and no errors.

This is the official webpack configuration file for using babel in vue:
https://github.com/Esri/arcgis-js-cli/blob/master/templates/vue/app/webpack.config.js

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions