forked from n5ro/aframe-physics-system
-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move builds from browserify to webpack #22
Draft
diarmidmackenzie
wants to merge
7
commits into
c-frame:master
Choose a base branch
from
diarmidmackenzie:webpack
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
498bf51
Moving to webpack
diarmidmackenzie 2abbc57
Undo three-to-ammo version change (was unintended)
diarmidmackenzie 1c577c6
publicPath not needed
diarmidmackenzie 4328caa
Updated package-lock.json
diarmidmackenzie ab14281
Updated builds
diarmidmackenzie b248550
Fix karma to work with webpack
diarmidmackenzie 5b31946
Merge remote-tracking branch 'upstream/master' into webpack
diarmidmackenzie File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/** | ||
* @license | ||
* Copyright 2010-2022 Three.js Authors | ||
* SPDX-License-Identifier: MIT | ||
*/ |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,8 +4,10 @@ | |
"description": "Physics system for A-Frame VR, built on Cannon.js & Ammo.js", | ||
"main": "index.js", | ||
"scripts": { | ||
"dev": "budo index.js:dist/aframe-physics-system.js -d examples --port 8000 -- -g browserify-shim", | ||
"dist": "browserify -g browserify-shim index.js -o dist/aframe-physics-system.js && uglifyjs -c -o dist/aframe-physics-system.min.js -- dist/aframe-physics-system.js", | ||
"dev": "npx webpack serve", | ||
"dist": "npm run dist:dev && npm run dist:prod", | ||
"dist:dev": "webpack --config webpack.config.js", | ||
"dist:prod": "webpack --config webpack.prod.config.js", | ||
"test": "karma start ./tests/karma.conf.js", | ||
"test:once": "karma start ./tests/karma.conf.js --single-run", | ||
"test:firefox": "karma start ./tests/karma.conf.js --browsers Firefox", | ||
|
@@ -17,9 +19,6 @@ | |
"postversion": "git push && git push --tags && npm publish", | ||
"postinstall": "patch-package" | ||
}, | ||
"browserify-shim": { | ||
"three": "global:THREE" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/c-frame/aframe-physics-system.git" | ||
|
@@ -49,36 +48,35 @@ | |
"cannon-es": "^0.9.1", | ||
"three-to-ammo": "^0.1.0", | ||
"three-to-cannon": "^4.0.0", | ||
"webworkify": "^1.4.0" | ||
"webpack": "^5.75.0", | ||
"webpack-dev-server": "^4.11.1", | ||
"webworkify-webpack": "^2.1.5" | ||
}, | ||
"peerDependencies": { | ||
"aframe": ">=0.5.0" | ||
}, | ||
"devDependencies": { | ||
"aframe": "~1.1.0", | ||
"browserify": "^16.5.1", | ||
"browserify-css": "^0.15.0", | ||
"browserify-shim": "^3.8.14", | ||
"budo": "^11.6.3", | ||
"chai": "^3.5.0", | ||
"chai-shallow-deep-equal": "^1.4.6", | ||
"envify": "^4.1.0", | ||
"karma": "^4.4.1", | ||
"karma-browserify": "^6.1.0", | ||
"karma-chai-shallow-deep-equal": "0.0.4", | ||
"karma-chrome-launcher": "^2.2.0", | ||
"karma-env-preprocessor": "^0.1.1", | ||
"karma-firefox-launcher": "^1.3.0", | ||
"karma-mocha": "^1.3.0", | ||
"karma-mocha-reporter": "^2.2.5", | ||
"karma-sinon-chai": "^1.3.4", | ||
"karma-webpack": "^5.0.0", | ||
"mocha": "^6.2.3", | ||
"patch-package": "^6.5.0", | ||
"replace": "^1.2.0", | ||
"sinon": "^2.4.1", | ||
"sinon-chai": "^2.14.0", | ||
"three": ">=0.125.0", | ||
"uglify-es": "^3.3.9" | ||
"uglify-es": "^3.3.9", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can remove the |
||
"webpack-cli": "^5.0.1" | ||
}, | ||
"directories": { | ||
"doc": "docs", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// Webpack uses this to work with directories | ||
const path = require('path'); | ||
|
||
// This is the main configuration object. | ||
// Here, you write different options and tell Webpack what to do | ||
module.exports = { | ||
|
||
// Path to your entry point. From this file Webpack will begin its work | ||
entry: './index.js', | ||
|
||
// Path and filename of your result bundle. | ||
// Webpack will bundle all JavaScript into this file | ||
output: { | ||
path: path.resolve(__dirname, 'dist'), | ||
filename: 'aframe-physics-system.js' | ||
}, | ||
|
||
resolve: { | ||
fallback: { | ||
"fs": false, | ||
"path": false | ||
}, | ||
}, | ||
|
||
devServer: { | ||
static: { | ||
directory: path.join(__dirname, ''), | ||
}, | ||
|
||
onListening: function (devServer) { | ||
if (!devServer) { | ||
throw new Error('webpack-dev-server is not defined'); | ||
} | ||
const brightYellow = "\x1b[1m\x1b[33m" | ||
const underscoreCyan = "\x1b[4m\x1b[36m" | ||
const reset = "\x1b[0m" | ||
|
||
const port = devServer.server.address().port; | ||
console.log(brightYellow) | ||
console.log("***********************************************************************"); | ||
console.log(`* View examples at ${underscoreCyan}http://localhost:${port}/examples${reset}${brightYellow} *`); | ||
console.log("***********************************************************************"); | ||
console.log(reset) | ||
}, | ||
}, | ||
|
||
// Default mode for Webpack is production. | ||
// Depending on mode Webpack will apply different things | ||
// on the final bundle. For now, we don't need production's JavaScript | ||
// minifying and other things, so let's set mode to development | ||
mode: 'development' | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
var path = require('path'); | ||
var merge = require('webpack-merge').merge; | ||
var commonConfiguration = require('./webpack.config.js'); | ||
|
||
module.exports = merge(commonConfiguration, { | ||
output: { | ||
path: path.resolve(__dirname, 'dist'), | ||
filename: 'aframe-physics-system.min.js' | ||
}, | ||
mode: 'production' | ||
}); |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You will need to define three as external if webpack is using three-to-ammo as ES6 module that itself import from three. See the webpack config in aframe-inspector https://github.com/aframevr/aframe-inspector/blob/e8798c73b6abd51566107e21a007f6fe90fbb5ad/webpack.config.js#L21-L24