Code Monkey home page Code Monkey logo

Comments (10)

andygup avatar andygup commented on June 18, 2024

I haven't seen that error before. What's the pathname for buffer.js? Is that a JS API module?

I'll run some tests on my end.

from angular-cli-esri-map.

andygup avatar andygup commented on June 18, 2024

@nbabel I didn't see the same issues you reported but I also wasn't able to run the webpack sample using 4.17. I'll need to investigate further. Here's a screenshot of the errors I'm seeing:

image

from angular-cli-esri-map.

andygup avatar andygup commented on June 18, 2024

Okay, the problem I'm seeing is when you upgrade the webpack plugin you also need to set the DEFAULT_WORKER_URL to the same base version of the plugin. So once I did the following then the app worked for me:

const DEFAULT_WORKER_URL = "https://js.arcgis.com/4.17/";

from angular-cli-esri-map.

nbabel avatar nbabel commented on June 18, 2024

Thanks @andygup, I have set the DEFAULT_WORKER_URL to the same as the base version of the plugin, but it's still not working.
Here is the full warning I get in a shell window when I run npm install:

warning: templates not found in C:\Users\NBabel\AppData\Local\Temp\pacote-git-template-tmp\git-clone-0c79d1e2

Here is the full error I'm getting from ng serve:

95% emitting index-html-webpack-pluginbuffer.js:313
  throw new ERR_INVALID_ARG_TYPE(
  ^

TypeError [ERR_INVALID_ARG_TYPE]: The first argument must be of type string or an instance of Buffer, ArrayBuffer, or Array or an Array-like Object. Received undefined
    at Function.from (buffer.js:313:9)
    at writeOut (C:\Projects\WFDSS\NextGen\repo\code\UI_NextGen\node_modules\webpack\lib\Compiler.js:413:27)
    at Immediate._onImmediate (C:\Projects\WFDSS\NextGen\repo\code\UI_NextGen\node_modules\memory-fs\lib\MemoryFileSystem.js:288:4)
    at processImmediate (internal/timers.js:456:21) {
  code: 'ERR_INVALID_ARG_TYPE'
}

The only thing I'm changing in my package.json file is
"dependencies": { "@types/arcgis-js-api": "4.17.0", }
"devDependencies": { "@arcgis/webpack-plugin": "4.17", }

I'm using node v12.16.0 if that makes any difference.

from angular-cli-esri-map.

andygup avatar andygup commented on June 18, 2024

@nbabel thanks. You might try this in your webpack config:


 node: {
 process: false,
 global: false,
 Buffer: false,
 setImmediate: false,
 fs: 'empty',
 },

from angular-cli-esri-map.

nbabel avatar nbabel commented on June 18, 2024

Unfortunately, that had no effect. This is my webpack.config file without those changes:

const ArcGISPlugin = require("@arcgis/webpack-plugin");
const LiveReloadPlugin = require('webpack-livereload-plugin');
const options = {
  protocol: 'http',
  port: 35730,
  hostname: 'localhost',
  // appendScriptTag: true,
  delay: 0,

};

module.exports = {
  plugins: [
    new ArcGISPlugin(),
    new LiveReloadPlugin(options)
  ],
  node: {
    process: false,
    global: false,
    fs: "empty"
  }
};

from angular-cli-esri-map.

andygup avatar andygup commented on June 18, 2024

Gotcha. I have a some questions:

  1. Make sure you are running the latest version of the webpack-plugin: npm install @arcgis/webpack-plugin@latest. Your version should 4.17.5
  2. Can you paste your package.json file here?
  3. What is index-html-webpack-pluginbuffer.js? It's in the error message you posted. It's sounds like a webpack file but I did a quick search for it and didn't find anything obvious.
  4. And buffer.js Is that the buffer module from node.js or one of yours? Just double checking.
at Function.from (buffer.js:313:9)
  1. Can you create a stackblitz app that reproduces this issue?

from angular-cli-esri-map.

andygup avatar andygup commented on June 18, 2024

Closing as inactive. Feel free to provide follow-up info, if needed.

from angular-cli-esri-map.

nbabel avatar nbabel commented on June 18, 2024

Just getting back to this. It appears using version 4.17.5 has done the trick. I'm not getting the errors I was before and the map and layers are loading correctly. However, there is a warning in the console: Failed to create Worker. Fallback to execute module in main thread.

It has a message of: Uncaught NetworkError: Failed to execute 'importScripts' on 'WorkerGlobalScope': The script at 'https://js.arcgis.com/4.17.5/dojo/dojo-lite.js' failed to load. Is dojo-lite.js not included with 4.17.5 anymore?

Everything appears to be working, so I guess it isn't needed?

from angular-cli-esri-map.

andygup avatar andygup commented on June 18, 2024

Good deal. That message is a performance degradation warning because the workers aren't configured correctly.

You might try out @arcgis/core which will go into beta in the week or two: https://www.npmjs.com/package/@arcgis/core. That build uses native ES modules (rather than AMD), won't need to configure webpack and the workers code is embedded.

More info here: https://github.com/Esri/feedback-js-api-next/tree/master/esm-samples/jsapi-angular-cli

from angular-cli-esri-map.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.