diff --git a/package.json b/package.json index 22367b49028330..1726b815537fbe 100644 --- a/package.json +++ b/package.json @@ -4,6 +4,10 @@ "description": "JavaScript 3D library", "main": "build/three.js", "module": "build/three.module.js", + "exports": { + "import": "./build/three.mjs", + "default": "./build/three.js" + }, "types": "src/Three.d.ts", "repository": { "type": "git", diff --git a/utils/build/rollup.config.js b/utils/build/rollup.config.js index 2cf00fdb2a6da3..ac7bf7c34af02a 100644 --- a/utils/build/rollup.config.js +++ b/utils/build/rollup.config.js @@ -235,5 +235,19 @@ export default [ indent: '\t' } ] + }, + { + input: 'src/Three.js', + plugins: [ + glconstants(), + glsl(), + ], + output: [ + { + format: 'esm', + file: 'build/three.mjs', + indent: '\t' + } + ] } ];