https://github.com/AnalyticalGraphicsInc/cesium/issues/6480
https://github.com/AnalyticalGraphicsInc/cesium/pull/6420
After reviewing the PR and issue on GitHub I couldn't really make heads or tails of which way to go here. It sounds like the WebAssembly modules are already built and delivered similarly to the GLSL codes/modules, but possibly there's a build step I need to perform on Cesium now?
Either way, somehow the inclusion of WebAssembly into the mix is tripping up my Webpack build; here are the details (webpack compile):
> WARNING in ./node_modules/cesium/Source/ThirdParty/draco_decoder.wasm
> Module build failed: TypeError: Cannot read property 'fileLoader' of undefined
> at Object.module.exports (/home/nmschulte/map-project/node_modules/file-loader/index.js:14:28)
> @ ./node_modules/cesium/Source/ThirdParty sync ^.\/.*$
> @ ./node_modules/cesium/Source/ThirdParty/xss.js
> @ ./node_modules/cesium/Source/Core/Credit.js
> @ ./node_modules/cesium/Source/Core/IonResource.js
> @ ./node_modules/cesium/Source/Core/createWorldTerrain.js
> @ ./src/cesium/CesiumGlobe.jsx
> @ ./src/App.js
> @ ./src/index.js
> @ multi ./scripts/config/polyfills.js ./src/index.js
>
> WARNING in ./node_modules/cesium/Source/ThirdParty/Shaders/FXAA3_11.glsl
> Module build failed: TypeError: Cannot read property 'fileLoader' of undefined
> at Object.module.exports (/home/nmschulte/map-project/node_modules/file-loader/index.js:14:28)
> @ ./node_modules/cesium/Source/ThirdParty sync ^.\/.*$
> @ ./node_modules/cesium/Source/ThirdParty/xss.js
> @ ./node_modules/cesium/Source/Core/Credit.js
> @ ./node_modules/cesium/Source/Core/IonResource.js
> @ ./node_modules/cesium/Source/Core/createWorldTerrain.js
> @ ./src/cesium/CesiumGlobe.jsx
> @ ./src/App.js
> @ ./src/index.js
> @ multi ./scripts/config/polyfills.js ./src/index.js
>
> ERROR in chunk main [entry]
> [name].js
> Sync WebAssembly compilation is not yet implemented
> Error: Sync WebAssembly compilation is not yet implemented
> at moduleTemplate.hooks.content.tap (/home/nmschulte/map-project/node_modules/webpack/lib/wasm/WasmModuleTemplatePlugin.js:17:13)
> at SyncWaterfallHook.eval [as call] (eval at create (/home/nmschulte/map-project/node_modules/tapable/lib/HookCodeFactory.js:17:12), <anonymous>:7:16)
> at ModuleTemplate.render (/home/nmschulte/map-project/node_modules/webpack/lib/ModuleTemplate.js:49:54)
> at modules.map.module (/home/nmschulte/map-project/node_modules/webpack/lib/Template.js:157:28)
> at Array.map (<anonymous>)
> at Function.renderChunkModules (/home/nmschulte/map-project/node_modules/webpack/lib/Template.js:154:28)
> at compilation.mainTemplate.hooks.modules.tap (/home/nmschulte/map-project/node_modules/webpack/lib/JavascriptModulesPlugin.js:86:23)
> at SyncWaterfallHook.eval [as call] (eval at create (/home/nmschulte/map-project/node_modules/tapable/lib/HookCodeFactory.js:17:12), <anonymous>:7:16)
> at SyncWaterfallHook.lazyCompileHook [as _call] (/home/nmschulte/map-project/node_modules/tapable/lib/Hook.js:35:21)
> at MainTemplate.hooks.render.tap (/home/nmschulte/map-project/node_modules/webpack/lib/MainTemplate.js:128:25)
> at SyncWaterfallHook.eval [as call] (eval at create (/home/nmschulte/map-project/node_modules/tapable/lib/HookCodeFactory.js:17:12), <anonymous>:7:16)
> at SyncWaterfallHook.lazyCompileHook [as _call] (/home/nmschulte/map-project/node_modules/tapable/lib/Hook.js:35:21)
> at MainTemplate.render (/home/nmschulte/map-project/node_modules/webpack/lib/MainTemplate.js:327:34)
> at Object.render (/home/nmschulte/map-project/node_modules/webpack/lib/JavascriptModulesPlugin.js:66:34)
> at Compilation.createChunkAssets (/home/nmschulte/map-project/node_modules/webpack/lib/Compilation.js:1752:29)
> at hooks.optimizeTree.callAsync.err (/home/nmschulte/map-project/node_modules/webpack/lib/Compilation.js:933:10)
(webpack config; paths.cesiumSource === '/home/nmschulte/map-project/node_modules/cesium/Source'):
> {
> // ...
>
> resolve: {
> alias: {
> 'cesium': paths.cesiumSource,
> // ...
> },
> // ...
> },
>
> plugins: [
> // copy Cesium assets
> new CopyWebpackPlugin([
> { from: path.join(paths.cesiumSource, 'Assets'), to: 'Assets' },
> { from: path.join(paths.cesiumSource, 'ThirdParty'), to: 'ThirdParty' },
> { from: path.join(paths.cesiumSource, 'Widgets'), to: 'Widgets' },
> { from: path.join(paths.cesiumSource, 'Workers'), to: 'Workers' },
> { from: path.join(paths.cesiumSource, '../Build/Cesium/ThirdParty/Workers'), to: 'ThirdParty/Workers', force: true },
> { from: path.join(paths.cesiumSource, '../Build/Cesium/Workers'), to: 'Workers', force: true }
> ]),
> // ...
> ],
> // ...
> }
Thanks for looking.
--
Nate
Still, I wonder how Cesium expects this to work with Webpack, and how/if the noted fallback mechanism works.
--
Nate
const configValues = require("../config");
const path = require("path");
const webpack = require("webpack");
const UglifyJsPlugin = require("uglifyjs-webpack-plugin");
const PATHS = configValues.PATHS;
const outputPath = path.join(PATHS.base, "distdll");
const webpackConfig = {
entry : {
Cesium : ["cesium/Source/Cesium.js"],
},
devtool : "#source-map",
output : {
path : outputPath,
filename : "[name].dll.js",
library : "[name]",
sourcePrefix: "",
},
plugins : [
new webpack.DllPlugin({
path : path.join(outputPath, "[name]-manifest.json"),
name : "Cesium",
context : configValues.CESIUM.sourcePath
}),
// Ignore anything related to Cesium's use of the Draco model compression library,
// which includes several very large modules. We don't need any of that.
new webpack.IgnorePlugin(/draco/),
new webpack.DefinePlugin({
'process.env.NODE_ENV': configValues.buildEnv,
}),
],
module : {
unknownContextCritical : false,
unknownContextRegExp: /^.\/.*$/,
rules : [
{
test : /\.css$/,
use: [
"style-loader",
"css-loader"
]
},
{
test : /\.(png|gif|jpg|jpeg)$/,
use : ["file-loader"]
},
{
test: /\.glsl$/,
use: ['file-loader' ]
}
]
},
externals: {
'fs': true,
}
};
if(configValues.isProd) {
webpackConfig.plugins.push(
new UglifyJsPlugin({
sourceMap : true,
})
);
}
module.exports = webpackConfig;