In the web application I already have some packages declared with "require" and understood by webpack:
- three
- three-orbit-controls
This is how I use it:
var THREE = require('three');
var OrbitControls = require('three-orbit-controls')(THREE);
To add physics, I try to add library physijs-webpack:
var PhysiJS = require('physijs-webpack')(THREE);
It fails at "npm run build" saying: Module not found: Error: Can't resolve 'physijs-webpack'
In the console (Chrome dev tools) following error is displayed:
"app.js:17 Uncaught Error: Cannot find module "physijs-webpack"
at webpackMissingModule (app.js:17)
at Object.defineProperty.value (app.js:17)
at __webpack_require__ (bootstrap 460ca68f8e6f1e90ea58:19)
at Object.<anonymous> (html5-entities.js:190)
at __webpack_require__ (bootstrap 460ca68f8e6f1e90ea58:19)
at module.exports.ctor.super_ (bootstrap 460ca68f8e6f1e90ea58:62)"
This is my webpack.config file:
var path = require('path');
var webpack = require('webpack');
module.exports = {
entry: './src/js/app.js',
devtool: 'inline-source-map',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'bundle.js',
publicPath: '/dist'
}
};
Dependencies are:
"devDependencies": {
"script-loader": "^0.7.0",
"webpack": "^3.5.4",
"webpack-dev-server": "^2.7.1",
"yarn": "^0.27.5"
},
"dependencies": {
"physijs": "^0.0.4",
"physijs-webpack": "^0.0.2",
"requirejs": "^2.3.4",
"three": "^0.86.0",
"three-orbit-controls": "^82.1.0"
}
}
Could you please recommend, what am I doing wrong?