-
-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
src in build folder #163
Comments
Hi @xlslucky, This is due to how Rollup's It's explained in this comment:
|
You can solve it using 2 plugins + 1 extra configuration :) As for configuration, you will need to add this on your output: an example: import replace from '@rollup/plugin-replace';
import rename from 'rollup-plugin-rename';
export default {
input: 'src/index.ts',
output: [
{
dir: 'dist',
format: 'cjs',
exports: 'named',
sourcemap: true,
preserveModules: true,
preserveModulesRoot: 'src',
entryFileNames: '[name].mjs',
},
{
dir: 'dist',
format: 'es',
exports: 'named',
sourcemap: true,
preserveModules: true,
preserveModulesRoot: 'src',
},
],
// your configuration
plugins: [
// your other plugins
rename({
include: ['**/*.js', '**/*.mjs'],
map: (name) => name.replace('node_modules/', 'external/'),
}),
replace({
values: {
'node_modules/': 'external/'
},
delimiters: ['', '']
})
],
} |
@prma85 thank you very much. But in my project, I need to simply modify the configuration of the replace plugin replace({
values: {
'../node_modules/': '../external/',
},
// ...
}), |
dist
after buildI expect to get
What should I do?
The text was updated successfully, but these errors were encountered: