-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Use import/export instead of require()/module.exports #5632
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,6 +4,9 @@ | |
| "ecmaVersion": 12 | ||
| }, | ||
| "rules": { | ||
| /* To work towards no-build. */ | ||
| "import/extensions": ["warn", "always", { "js": "always" }], | ||
|
|
||
| /* These rules are incompatible with ES5. */ | ||
| "no-var": "off", | ||
| "object-shorthand": "off", | ||
|
|
@@ -36,8 +39,15 @@ | |
| The exception is that ES6 classes are used sparingly - see exceptions below. */ | ||
| "files": ["./src/**/*.js"], | ||
| "parserOptions": { | ||
| "sourceType": "script", | ||
| "ecmaVersion": 5 | ||
| "sourceType": "module", | ||
| "ecmaVersion": 6 | ||
| } | ||
| }, | ||
| { | ||
| /* This acts as a barrel file and uses 'export as', which is an ES11 feature */ | ||
| "files": ["./src/utils/index.js"], | ||
| "parserOptions": { | ||
| "ecmaVersion": 11 | ||
|
Contributor
Author
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. Currently needed due to |
||
| } | ||
| }, | ||
| { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,57 +1,57 @@ | ||
| require('./animation'); | ||
| require('./anchored'); | ||
| require('./camera'); | ||
| require('./cursor'); | ||
| require('./geometry'); | ||
| require('./generic-tracked-controller-controls'); | ||
| require('./gltf-model'); | ||
| require('./grabbable'); | ||
| require('./hand-tracking-controls'); | ||
| require('./hand-tracking-grab-controls'); | ||
| require('./hand-controls'); | ||
| require('./hide-on-enter-ar'); | ||
| require('./hide-on-enter-vr'); | ||
| require('./hp-mixed-reality-controls'); | ||
| require('./layer'); | ||
| require('./laser-controls'); | ||
| require('./light'); | ||
| require('./line'); | ||
| require('./link'); | ||
| require('./logitech-mx-ink-controls'); | ||
| require('./look-controls'); | ||
| require('./magicleap-controls'); | ||
| require('./material'); | ||
| require('./obb-collider'); | ||
| require('./obj-model'); | ||
| require('./oculus-go-controls'); | ||
| require('./meta-touch-controls'); | ||
| require('./pico-controls'); | ||
| require('./position'); | ||
| require('./raycaster'); | ||
| require('./rotation'); | ||
| require('./scale'); | ||
| require('./shadow'); | ||
| require('./sound'); | ||
| require('./text'); | ||
| require('./tracked-controls'); | ||
| require('./visible'); | ||
| require('./valve-index-controls'); | ||
| require('./vive-controls'); | ||
| require('./vive-focus-controls'); | ||
| require('./wasd-controls'); | ||
| require('./windows-motion-controls'); | ||
| import './animation.js'; | ||
| import './anchored.js'; | ||
| import './camera.js'; | ||
| import './cursor.js'; | ||
| import './geometry.js'; | ||
| import './generic-tracked-controller-controls.js'; | ||
| import './gltf-model.js'; | ||
| import './grabbable.js'; | ||
| import './hand-tracking-controls.js'; | ||
| import './hand-tracking-grab-controls.js'; | ||
| import './hand-controls.js'; | ||
| import './hide-on-enter-ar.js'; | ||
| import './hide-on-enter-vr.js'; | ||
| import './hp-mixed-reality-controls.js'; | ||
| import './layer.js'; | ||
| import './laser-controls.js'; | ||
| import './light.js'; | ||
| import './line.js'; | ||
| import './link.js'; | ||
| import './logitech-mx-ink-controls.js'; | ||
| import './look-controls.js'; | ||
| import './magicleap-controls.js'; | ||
| import './material.js'; | ||
| import './meta-touch-controls.js'; | ||
| import './obb-collider.js'; | ||
| import './obj-model.js'; | ||
| import './oculus-go-controls.js'; | ||
|
Comment on lines
+24
to
+27
Contributor
Author
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. Diff looks a tad strange, as I moved |
||
| import './pico-controls.js'; | ||
| import './position.js'; | ||
| import './raycaster.js'; | ||
| import './rotation.js'; | ||
| import './scale.js'; | ||
| import './shadow.js'; | ||
| import './sound.js'; | ||
| import './text.js'; | ||
| import './tracked-controls.js'; | ||
| import './visible.js'; | ||
| import './valve-index-controls.js'; | ||
| import './vive-controls.js'; | ||
| import './vive-focus-controls.js'; | ||
| import './wasd-controls.js'; | ||
| import './windows-motion-controls.js'; | ||
|
|
||
| require('./scene/ar-hit-test'); | ||
| require('./scene/background'); | ||
| require('./scene/debug'); | ||
| require('./scene/device-orientation-permission-ui'); | ||
| require('./scene/embedded'); | ||
| require('./scene/inspector'); | ||
| require('./scene/fog'); | ||
| require('./scene/keyboard-shortcuts'); | ||
| require('./scene/pool'); | ||
| require('./scene/real-world-meshing'); | ||
| require('./scene/reflection'); | ||
| require('./scene/screenshot'); | ||
| require('./scene/stats'); | ||
| require('./scene/xr-mode-ui'); | ||
| import './scene/ar-hit-test.js'; | ||
| import './scene/background.js'; | ||
| import './scene/debug.js'; | ||
| import './scene/device-orientation-permission-ui.js'; | ||
| import './scene/embedded.js'; | ||
| import './scene/inspector.js'; | ||
| import './scene/fog.js'; | ||
| import './scene/keyboard-shortcuts.js'; | ||
| import './scene/pool.js'; | ||
| import './scene/real-world-meshing.js'; | ||
| import './scene/reflection.js'; | ||
| import './scene/screenshot.js'; | ||
| import './scene/stats.js'; | ||
| import './scene/xr-mode-ui.js'; | ||
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.
Webpack doesn't need the
.jssuffix, but if the goal is to work towards a no-build setup it will be required. Thought it would be a good idea to start enforcing it regardless.