Fixed webpack configuration to work with latest vtk-js.
The changes include:
Create an alias `vtk` to the compiled `vtk.js` in the `vtk.js/dist`
director.
Comment out passing the whole code-base through Uglify.js.
MODIFY
external.config.js
external.config.js
@@ -15,7 +15,8 @@ module.exports = {
resolve: {
alias: {
d3: 'd3/d3.js',
- hammerjs: 'hammerjs/hammer.js'
+ hammerjs: 'hammerjs/hammer.js',
+ vtk: 'vtk.js/dist/vtk.js'
}
},
plugins: [
@@ -30,6 +31,8 @@ module.exports = {
test: require.resolve('d3'), loader: 'expose?d3'
}, {
test: require.resolve('hammerjs'), loader: 'expose?hammerjs'
+ }, {
+ test: require.resolve('vtk.js'), loader: 'expose?vtk'
}]
}
};

MODIFY
package.json
package.json
"hammerjs": "^2.0.8"
},
"devDependencies": {
-<<<<<<< HEAD
-=======
"babel-core": "^6.0.0",
"babel-loader": "^6.0.0",
"babel-plugin-istanbul": "2.0.0",
"babel-preset-react": "^6.16.0",
"babel-preset-stage-2": "^6.18.0",
"blanket": "~1.2",
->>>>>>> Fixed build that works with vtk.js
"body-parser": "^1.15.0",
"bootstrap": "^3.3.6",
"bootswatch": "^3.3.6",

MODIFY
src/vtkjs/pointFeature.js
src/vtkjs/pointFeature.js
@@ -4,10 +4,10 @@ var registerFeature = require('../registry').registerFeature;
var pointFeature = require('../pointFeature');
-var vtkActor = require('vtk.js/Sources/Rendering/Core/Actor');
-var vtkMapper = require('vtk.js/Sources/Rendering/Core/Mapper');
-var vtkSphereSource = require('vtk.js/Sources/Filters/Sources/SphereSource');
-var vtkPlaneSource = require('vtk.js/Sources/Filters/Sources/PlaneSource');
+var vtkActor;// = require('vtk.js/Sources/Rendering/Core/Actor');
+var vtkMapper;// = require('vtk.js/Sources/Rendering/Core/Mapper');
+var vtkSphereSource;// = require('vtk.js/Sources/Filters/Sources/SphereSource');
+var vtkPlaneSource;// = require('vtk.js/Sources/Filters/Sources/PlaneSource');
//////////////////////////////////////////////////////////////////////////////
/**

MODIFY
src/vtkjs/vtkjsRenderer.js
src/vtkjs/vtkjsRenderer.js
var inherit = require('../inherit');
var registerRenderer = require('../registry').registerRenderer;
var renderer = require('../renderer');
-var vtkOpenGLRenderWindow = require('vtk.js/Sources/Rendering/OpenGL/RenderWindow');
-var vtkFullScreenRenderWindow = require('vtk.js/Sources/Testing/FullScreenRenderWindow');
-var vtkRenderer = require('vtk.js/Sources/Rendering/Core/Renderer');
-var vtkRenderWindow = require('vtk.js/Sources/Rendering/Core/RenderWindow');
+var vtk = require('vtk');
+//var vtkOpenGLRenderWindow;// = require('vtk.js/Sources/Rendering/OpenGL/RenderWindow');
+//var vtkFullScreenRenderWindow;// = require('vtk.js/Sources/Testing/FullScreenRenderWindow');
+//var vtkRenderer;// = require('vtk.js/Sources/Rendering/Core/Renderer');
+//var vtkRenderWindow;// = require('vtk.js/Sources/Rendering/Core/RenderWindow');
//////////////////////////////////////////////////////////////////////////////

MODIFY
webpack.config.js
webpack.config.js
@@ -2,7 +2,7 @@ var path = require('path');
var webpack = require('webpack');
var exec = require('child_process').execSync;
var sha = '';
-var loaders = require('./node_modules/vtk.js/Utilities/config/webpack.loaders.js');
+// var loaders = require('./node_modules/vtk.js/Utilities/config/dependency.js').webpack.v1.loaders;
if (!exec) {
console.warn('Node 0.12 or greater is required for detecting the git hash.');
@@ -34,6 +34,7 @@ module.exports = {
},
resolve: {
alias: {
+ vtk: 'vtk.js/dist/vtk.js',
jquery: 'jquery/dist/jquery',
proj4: 'proj4/lib',
vgl: 'vgl/vgl.js',
@@ -44,15 +45,16 @@ module.exports = {
},
externals: {
d3: 'd3',
- hammerjs: 'Hammer'
+ hammerjs: 'Hammer',
+ vtk: 'vtk.js'
},
plugins: [
- define_plugin,
- new webpack.optimize.UglifyJsPlugin({
+ define_plugin
+ /* new webpack.optimize.UglifyJsPlugin({
include: /\.min\.js$/,
minimize: true,
comments: /@(license|copyright)/
- })
+ })*/
],
module: {
loaders: [{
@@ -68,7 +70,8 @@ module.exports = {
test: /vgl\.js$/,
loader: 'expose?vgl!imports?mat4=gl-mat4,vec4=gl-vec4,vec3=gl-vec3,vec2=gl-vec2,$=jquery'
}
- ].concat(loaders)
+ ]
+ // .concat(loaders)
},
// These are plugins that we want to run in Karma as well

Fixed webpack configuration to work with latest vtk-js.

The changes include:

- Create an alias `vtk` to the compiled `vtk.js` in the `vtk.js/dist`
director.
- Comment out passing the whole code-base through Uglify.js.