maxdow / cesiumjs-webpack-boilerplate Goto Github PK
View Code? Open in Web Editor NEWA simple boilerplate to get started with cesiumjs
A simple boilerplate to get started with cesiumjs
Thanks maxdow, It is really fantasy! Iโm a beginner in webpack and try to move your project to angular 2 cli and get webpack.config.js through ng eject. And I notice the angular 2 use Webpack 2. So I upgrade the webpack and webpack-dev to
"webpack": "^2.2.0 ",
"webpack-dev-server": "~2.4.2"
in your project. Current pacage.json file is:
{
"name": "cesium-webpack-boilerplate",
"version": "1.1.0",
"description": "A boilerplate for cesiumjs",
"main": "app.js",
"scripts": {
"clean": "mkdirp public & rimraf public/*",
"build": "npm run clean && cpr node_modules/cesium/Build/Cesium public && webpack --config config/webpack.config.js --progress",
"devserver": "webpack-dev-server --config config/webpack.config.js --progress --watch",
"dev": "npm run build && npm run devserver",
"release": "npm run build -- --optimize-minimize"
},
"author": "Maxime Warnier",
"license": "MIT",
"dependencies": {
"cesium": "^1.19.0"
},
"devDependencies": {
"cpr": "^1.1.2",
"css-loader": "^0.23.1",
"file-loader": "^0.9.0",
"html-webpack-plugin": "^2.22.0",
"mkdirp": "^0.5.1",
"rimraf": "^2.5.2",
"script-loader": "^0.7.0",
"style-loader": "^0.13.0",
"webpack": "^2.2.0 ",
"webpack-dev-server": "~2.4.2"
}
}
Current Webpack.config.js is
var HtmlPlugin = require("html-webpack-plugin");
const path = require('path');
module.exports = {
entry: "./src/app.js",
output: {
path: path.join(process.cwd(), "public"),
filename: "bundle.js",
sourcePrefix: ""
},
plugins: [
new HtmlPlugin({
template: "./src/index.html",
inject: "body"
})
],
devServer: {
contentBase: path.join(process.cwd(), "public")
},
module: {
unknownContextCritical: false,
loaders: [
{ test: /.css$/, loader: "style-loader!css-loader" },
{
test: /.(png|gif|jpg|jpeg)$/,
loader: "file-loader"
},
{ test: /Cesium.js$/, loader: "script-loader" }
]
}
};
But I get errors, when I debug the project.
Error constructing CesiumWidget.
Visit http://get.webgl.org 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 (http://localhost:8080/vendor.bundle.js:31564:69)
at buildModuleUrl (http://localhost:8080/vendor.bundle.js:31564:147)
at new Globe (http://localhost:8080/vendor.bundle.js:187847:34)
at new CesiumWidget (http://localhost:8080/vendor.bundle.js:228862:25)
at new Viewer (http://localhost:8080/vendor.bundle.js:234446:28)
at Object.358 (http://localhost:8080/main.bundle.js:59:14)
at webpack_require (http://localhost:8080/inline.bundle.js:55:30)
at Object.876 (http://localhost:8080/main.bundle.js:195:18)
at webpack_require (http://localhost:8080/inline.bundle.js:55:30)
at webpackJsonpCallback (http://localhost:8080/inline.bundle.js:26:23)
CesiumWidget.showErrorPanel
CesiumWidget
Viewer
358
webpack_require
876
webpack_require
webpackJsonpCallback
(anonymous function)
Uncaught Error: Cannot find module "."
webpackMissingModule
buildModuleUrl
Globe
CesiumWidget
Viewer
358
webpack_require
876
webpack_require
webpackJsonpCallback
(anonymous function)
Angular is running in the development mode. Call enableProdMode() to enable the production mode.
Hi maxdow,
I'm very new to Webpack, but not to Cesium. I did everything according to your specification in the README, but when I open the webpage I get this:
Is there any way to make Webpack copy over the contents of the cesium/Source/Widgets/Images
and cesium/Source/Assets
directories into the ./public
directory?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.