Problems importing DecalGeometry

Hi Threejs,

I am trying to use decalGeomety and am having problems importing in to my primary javascript class. Either of the two ways I might try give an error. My other three example lib has been coming in fine:

// threejs imports
import * as THREE from ‘three’ //works fine
import { OrbitControls } from ‘three/examples/jsm/controls/OrbitControls.js’; //works fine
// Gives --> DecalGeometry is not exported by …\node_modules\three\build\three.module.js
import { DecalGeometry } from ‘three/examples/jsm/geometries/DecalGeometry.js’;
// Gives -->disallowed mimetype
//import { DecalGeometry } from ‘https://raw.githubusercontent.com/mrdoob/three.js/master/examples/jsm/geometries/DecalGeometry.js’;

I am using Rollup --watch --config (I happenn to be using browser-sync but mainly for the wedserving aspect). Here is my config:

import resolve from ‘@rollup/plugin-node-resolve’;
import commonjs from ‘@rollup/plugin-commonjs’;
import copy from ‘rollup-plugin-copy’
import watchAssets from ‘rollup-plugin-watch-assets’
export default {
input: ‘src/app.js’,
output: {
file: ‘dist/html/app.js’,
format: ‘esm’
},
watch: {
include: ‘src/
},
plugins: [
resolve(),
commonjs(),
watchAssets({
assets: [‘src/*.html’, 'src/
.css’, ‘src/.json’, ‘src/images/**’ ]
}),
copy({
targets: [
{ src: 'src/
.html’, dest: ‘dist/html’ },
{ src: ‘src/.css’, dest: ‘dist/html’ },
{ src: 'src/
.json’, dest: ‘dist/html’ },
{ src: ‘src/images/**’, dest: ‘dist/html/images’ }
]
})
]
};

in my index file I am using:
<script src="app.js" type="module" ></script>

Can anyone given me any pointers on how to get this to work?

Why do you use the @rollup/plugin-commonjs? It should not be necessary. Check out this minimal build configuration with rollup:

I added it ages ago…I can’t remember what needed it but I’ve removed it and no change.