Esri / arcgis-webpack-plugin

Webpack plugin for the ArcGIS API for JavaScript
Apache License 2.0
134 stars 26 forks source link

CRA(create-react-app) add arcgis-webpack-plugin, compile failed #76

Closed nightsu closed 4 years ago

nightsu commented 4 years ago

this is the demo: https://github.com/nightsu/arcgis-react.git

Description

  1. CRA: npm create-react-app arcgis-react, and npm install,
  2. npm install @arcgis-webpack-plugin,
  3. npm run eject,
  4. add new ArcGISPlugin() to config/webpack.config.js const ArcGISPlugin = require("@arcgis/webpack-plugin"); ... module.exports = { ... plugins: [ ... new ArcGISPlugin(), ... ] ... }
  5. npm start

    Expected Behavior

    compile succeeded.

    Actual Behavior

    compile failed. error: if (!request.context.issuer) { ^ TypeError: Cannot read property 'issuer' of undefined at resolver.hooks.file.tapAsync (..\arcgis-react\node_modules\react-dev-utils\ModuleScopePlugin.js:26:30)

    Possible Fix

Steps to Reproduce

1.download or clone https://github.com/nightsu/arcgis-react.git 2.npm install 3.npm start

Context

Your Environment

shehabelhariry commented 4 years ago

I have the same issue. Any fixes?

nightsu commented 4 years ago

I have the same issue. Any fixes?

@shehabelhariry No, I think maybe there are some compatibility problems between CRA and arcgis webpack plugin. But there is another method: You can use the arcgis-js-cli to create a react arcgis template https://github.com/Esri/arcgis-js-cli#quick-start arcgis create jsapi-react-app -t react Hope it could help you.

shehabelhariry commented 4 years ago

@nightsu Thank you. The thing is I am integrating the api into an existing CRA. I used the esri-loader method and it worked successfully.

boualikamel commented 4 years ago

Hello everybody, @nightsu I've just tried to introduce jsapi4 into a CRA template, using react-app-rewired. it worked but the esri icons didnt yet worked if you have any suggestion to improve you can contribute.

this is the demo https://github.com/boualikamel/cra-arcgis

edited __

i've juste fixed the icon problem, i hope that will help you dude

odoe commented 4 years ago

Are we good with react-app-rewired solution here? Can this issue be closed?