Hi im working with sveltejs/template ( which comes with rollup) to create a basic dashboard. the thing is when i install the speckle viewer package i notice that it gives the following warning
and when i try to build after calling the viewer anywhere on my app i get the following error.
bundles src/main.js → public/build/bundle.js...
[!] Error: Could not load D:\Downloads\00-Rapid Dev\IoTDashboardSvelte\iotdashboard_ctec\node_modules\three\examples\jsm\utils\BufferGeometryUtils (imported by node_modules/@speckle/viewer/dist/speckleviewer.esm.js): ENOENT: no such file or directory, open 'D:\Downloads\00-Rapid Dev\IoTDashboardSvelte\iotdashboard_ctec\node_modules\three\examples\jsm\utils\BufferGeometryUtils'
pretty sure is a rollup config issue but all things i have try in the last two days are getting nowhere.
this is my rollup config right now (have been trying a lot of stuff
import svelte from 'rollup-plugin-svelte';
import commonjs from '@rollup/plugin-commonjs';
import nodeResolve from '@rollup/plugin-node-resolve';
import replace from '@rollup/plugin-replace';
//import rebasePlugin from 'rollup-plugin-rebase';
//import copyPlugin from 'rollup-plugin-copy';
import livereload from 'rollup-plugin-livereload';
import { terser } from 'rollup-plugin-terser';
import css from 'rollup-plugin-css-only';
//import renameNodeModules from 'rollup-plugin-rename-node-modules'
const production = !process.env.ROLLUP_WATCH;
function serve() {
let server;
function toExit() {
if (server) server.kill(0);
}
return {
writeBundle() {
if (server) return;
server = require('child_process').spawn('npm', ['run', 'start', '--', '--dev'], {
stdio: ['ignore', 'inherit', 'inherit'],
shell: true
});
process.on('SIGTERM', toExit);
process.on('exit', toExit);
}
};
}
export default [
{
input: 'src/main.js',
output: {
sourcemap: true,
format: 'iife',
name: 'app',
file: 'public/build/bundle.js',
},
plugins: [
//[renameNodeModules("ext")],
replace({
preventAssignment: true,
}),
svelte({
compilerOptions: {
// enable run-time checks when not in production
dev: !production
}
}),
// we'll extract any component CSS out into
// a separate file - better for performance
css({ output: 'bundle.css' }),
// If you have external dependencies installed from
// npm, you'll most likely need these plugins. In
// some cases you'll need additional configuration -
// consult the documentation for details:
// https://github.com/rollup/plugins/tree/master/packages/commonjs
nodeResolve({
browser: true,
jsnext:true,
main:true,
browser:true,
dedupe: ['svelte']
}),
commonjs({}),
// In dev mode, call `npm run start` once
// the bundle has been generated
!production && serve(),
// Watch the `public` directory and refresh the
// browser on changes when not in production
!production && livereload('public'),
// If we're building for production (npm run build
// instead of npm run dev), minify
production && terser()
],
watch: {
clearScreen: false
}
}];
The supported node version range is a bit strict for the viewer currently, we will look into relaxing that, but for the time being - can you try out the same setup with Node 16 as Dimitrie instructed?
I did just try installing @speckle/viewer in a new project and I was able to install it correctly and I can find the BufferGeometryUtils script in node_modules as well, which leads me to believe that the issue is somewhere in how your build config is setup. You did share the rollup config, but build processes are complicated and made up of many moving parts, so it would be more useful for debugging to see the entire configuration. Could you share a reproduction repo?
Hi Dimitrie just an update, i installed node 16 and i dont get the engine warning as expected but im still getting the missing BufferGeometryUtils error
@Ricardo_Zepeda I just cloned and successfully built the reproduction repo in a Linux environment, maybe it’s a Windows issue? When it comes to web development on Windows, I suggest using WSL anyway (which is what I use).