Skip to content
This repository has been archived by the owner on Jan 29, 2024. It is now read-only.

Commit

Permalink
Fix webpack issues by using a workaround
Browse files Browse the repository at this point in the history
The workaround is described in webpack/webpack#7352
Note that now the webserver cannot load our wasm:
"TypeError: _myelin_visualization_bg__WEBPACK_IMPORTED_MODULE_0__.init is not a function"
This might be caused by a transcient dependency on stdweb:
https://github.com/sebcrozet/nphysics/blob/master/build/nphysics2d/Cargo.toml#L31
Which is incompatible with wasm-bindgen:
koute/stdweb#263
  • Loading branch information
janhohenheim committed Sep 13, 2018
1 parent 2b8612d commit 9cf6e04
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 13 deletions.
13 changes: 7 additions & 6 deletions visualization/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@
"serve": "webpack-dev-server"
},
"devDependencies": {
"file-loader": "^2.0.0",
"ts-loader": "^4.4.2",
"typescript": "^2.9.2",
"webpack": "^4.0.1",
"webpack-cli": "^2.0.10",
"webpack-dev-server": "^3.1.0",
"tslint": "^5.5.0",
"tslint-config-standard": "^7.1.0",
"tslint-consistent-codestyle": "^1.6.0",
"tslint-immutable": "^4.0.2"
"tslint-immutable": "^4.0.2",
"typescript": "^2.9.2",
"webpack": "^4.0.1",
"webpack-cli": "^2.0.10",
"webpack-dev-server": "^3.1.0"
}
}
}
24 changes: 17 additions & 7 deletions visualization/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,25 @@ const path = require('path');

module.exports = {
entry: "./src/main.ts",
node: false,
mode: "development",
module: {
rules: [{
test: /\.ts$/,
use: 'ts-loader',
exclude: /node_modules/
}]
test: /\.ts$/,
exclude: /node_modules/,
use: 'ts-loader',
},
{
test: /\.wasm$/,
exclude: /node_modules/,
type: "javascript/auto",
loader: "file-loader",
options: {
publicPath: "dist/"
}
}
]
},
node: false,
output: {
publicPath: '/dist/',
path: path.resolve(__dirname, "dist"),
Expand All @@ -18,5 +29,4 @@ module.exports = {
resolve: {
extensions: ['.ts', '.js', '.wasm'],
},
mode: "development",
};
};
19 changes: 19 additions & 0 deletions visualization/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,10 @@ acorn@^5.0.0, acorn@^5.6.2:
version "5.7.2"
resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.7.2.tgz#91fa871883485d06708800318404e72bfb26dcc5"

ajv-errors@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/ajv-errors/-/ajv-errors-1.0.0.tgz#ecf021fa108fd17dfb5e6b383f2dd233e31ffc59"

ajv-keywords@^3.1.0:
version "3.2.0"
resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-3.2.0.tgz#e86b819c602cf8821ad637413698f1dec021847a"
Expand Down Expand Up @@ -2089,6 +2093,13 @@ figures@^2.0.0:
dependencies:
escape-string-regexp "^1.0.5"

file-loader@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/file-loader/-/file-loader-2.0.0.tgz#39749c82f020b9e85901dcff98e8004e6401cfde"
dependencies:
loader-utils "^1.0.2"
schema-utils "^1.0.0"

filename-regex@^2.0.0:
version "2.0.1"
resolved "https://registry.yarnpkg.com/filename-regex/-/filename-regex-2.0.1.tgz#c1c4b9bee3e09725ddb106b75c1e301fe2f18b26"
Expand Down Expand Up @@ -4495,6 +4506,14 @@ schema-utils@^0.4.4, schema-utils@^0.4.5:
ajv "^6.1.0"
ajv-keywords "^3.1.0"

schema-utils@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-1.0.0.tgz#0b79a93204d7b600d4b2850d1f66c2a34951c770"
dependencies:
ajv "^6.1.0"
ajv-errors "^1.0.0"
ajv-keywords "^3.1.0"

scoped-regex@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/scoped-regex/-/scoped-regex-1.0.0.tgz#a346bb1acd4207ae70bd7c0c7ca9e566b6baddb8"
Expand Down

0 comments on commit 9cf6e04

Please sign in to comment.