GithubHelp home page GithubHelp logo

Comments (9)

markerikson avatar markerikson commented on August 15, 2024 2

Looks like it's a use of this particular Webpack config option: https://webpack.js.org/configuration/other-options/#amd

In combination with this change to Cesium's code to look for that special value:

CesiumGS/cesium@9aa2dff#diff-1f2d871223708f3eeff38a7821941b90

from cesium-weather.

immiao avatar immiao commented on August 15, 2024 1

Thanks a lot for the tutorial!

After I put

    amd: {
        // Enable webpack-friendly use of require in Cesium
        toUrlUndefined: true
    },

in my webpack.config.js, it works.

from cesium-weather.

immiao avatar immiao commented on August 15, 2024

Resolved:

https://cesiumjs.org/forum/#!msg/cesium-dev/d69RrgOVu9c/RfCoBqrTBAAJ
http://blog.isquaredsoftware.com/2017/03/declarative-earth-part-1-cesium-webpack/

from cesium-weather.

immiao avatar immiao commented on August 15, 2024

Well, I followed the instruction but still got an error. My code structure is slightly different from the instruction. What could be the reason?

bundle.js:168429 Error constructing CesiumWidget.
Visit <a href="http://get.webgl.org">http://get.webgl.org</a> to verify that your web browser and hardware support WebGL.  Consider trying a different web browser or updating your video drivers.  Detailed error information is below:
Error: Cannot find module "."
Error: Cannot find module "."
    at webpackMissingModule (bundle.js:29861)
    at buildModuleUrl (bundle.js:29861)
    at new Globe (bundle.js:168694)
    at new CesiumWidget (bundle.js:168075)
    at new Viewer (bundle.js:103299)
    at App.componentDidMount (bundle.js:102847)
    at commitLifeCycles (bundle.js:96015)
    at commitAllLifeCycles (bundle.js:97191)
    at HTMLUnknownElement.callCallback (bundle.js:87787)
    at Object.invokeGuardedCallbackDev (bundle.js:87826)

My $PROJECT/index.js:

import React from 'react';
import ReactDOM from 'react-dom';
import App from './src/App';
import './node_modules/bootstrap/dist/css/bootstrap.min.css';
import "cesium/Source/Widgets/widgets.css";
import buildModuleUrl from "cesium/Source/Core/buildModuleUrl";

buildModuleUrl.setBaseUrl('./cesium/');
console.log(buildModuleUrl)

ReactDOM.render(<App />, document.getElementById('container'));

My $PROJECT/src/app.js:

import React, { Component } from 'react';
import Viewer from "cesium/Source/Widgets/Viewer/Viewer";

class App extends Component {
  componentDidMount() {
    var viewer = new Viewer(this.cesiumContainer);
  }

  render() {
    return (
      <div className="App">
        <div className="col-sm-9">
          <div id="cesiumContainer" ref={ element => this.cesiumContainer = element }/>
        </div>
        <div className="col-sm-3">
          Hello
        </div>
      </div>
    );
  }
}

export default App;

from cesium-weather.

markerikson avatar markerikson commented on August 15, 2024

Perhaps try removing the . from the module URL call? Like: buildModuleUrl.setBaseUrl('cesium/');

from cesium-weather.

immiao avatar immiao commented on August 15, 2024

I just tried that. But it doesn't work and gives the same error.

from cesium-weather.

markerikson avatar markerikson commented on August 15, 2024

Hmm. My next suggestion would be to try following the new Webpack setup instructions in the Cesium docs: https://cesiumjs.org/tutorials/cesium-and-webpack/

from cesium-weather.

immiao avatar immiao commented on August 15, 2024

But how does this work? I search around the Webpack documentation but can't find any information. Did Cesium team contribute this special thing to Webpack?

from cesium-weather.

immiao avatar immiao commented on August 15, 2024

Thanks a lot!!

from cesium-weather.

Related Issues (2)

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.