fix(frontend): workaround for @speckle/viewer not found error when running dev server (#892)

This commit is contained in:
Kristaps Fabians Geikins
2022-08-05 13:08:39 +03:00
committed by GitHub
parent 9c2959cf19
commit 0cc69fece8
+10 -12
View File
@@ -10,23 +10,18 @@ import { DEFAULT_EXTENSIONS } from '@babel/core'
const isProd = process.env.NODE_ENV === 'production'
const sourcemap = isProd ? false : 'inline'
/** @type {import('rollup').RollupOptions} */
const config = {
/** @returns {import('rollup').RollupOptions} */
const config = (file, format) => ({
input: 'src/index.ts',
output: [
{
file: 'dist/speckleviewer.esm.js',
format: 'esm',
sourcemap
},
{
file: 'dist/speckleviewer.js',
format: 'cjs',
file,
format,
sourcemap
}
],
plugins: [
clean({ targets: 'dist/*' }),
...(isProd ? [clean({ targets: 'dist/*' })] : []),
rebasePlugin({ keepName: true }),
copyPlugin({
targets: [{ src: './always-bundled-assets/**/*', dest: 'dist/assets' }]
@@ -44,6 +39,9 @@ const config = {
],
// Externalizing all deps, we don't want to bundle them in cause this is a library
external: Object.keys(pkg.dependencies || {}).map((d) => new RegExp(`^${d}(\\/.*)?$`))
}
})
export default config
export default [
config('dist/speckleviewer.esm.js', 'esm'),
config('dist/speckleviewer.js', 'cjs')
]