I'm practicing Rollup and I'm trying to import 'lit-element' to create an SPA. I can build the application but when I access to the page in localhost (deployed with VSCode plugin) in the console I can see this error:
Uncaught (in promise) TypeError: Failed to resolve module specifier "lit-element". Relative references must start with either "/", "./", or "../".
This is the configuration of my rollup.config.json
const config = {
input: ['src/components/shop-app.js', 'src/components/**/*.js', 'src/controller/**/*.js',
'src/controller/*.js'],
output: {
dir: `build-modern/src/`,
format: 'es'
},
plugins: [
alias({
entries: [
{ find: '@Controller', replacement: './controller' },
{ find: '@Components', replacement: './components' },
{ find: '@Utilities', replacement: './utilities' },
{ find: '@Modules', replacement: './node_modules' }
]
}),
multi(),
babel(babelConfig),
minifyHTML(),
copy(copyConfig),
commonjs({
namedExports: {
'node_modules/@babel/runtime/regenerator/index.js': ['isValidElementType'],
}
}),
nodeResolve(),
resolve(),
replace({
// Recogemos el valor y lo convertimos
ENV: JSON.stringify(process.env.NODE_ENV || 'development')
}),
scss()
],
preserveEntrySignatures: false,
}
And I import 'lit-element' like this:
import { css } from 'lit-element';
I hope this will be enough information about the problem but if you need more code or information please, ask me :)
Thank you all!