rollup-plugin-auto-external
rollup-plugin-auto-external copied to clipboard
Exclude specific builtins as an external
I wonder if I can exclude specific builtins as an external to support shimming. For example:
plugins: [
autoExternal({
builtins: {
include: '*'
exclude: ['readline']
}
}),
shim({
readline: "export default {createInterface(){}}"
})
]
For more granular control:
plugins: [
autoExternal({
builtins: {
include: '*'
+ exclude: {
+ '@npm/module1': ['readline']
+ }
}
}),
shim({
readline: "export default {createInterface(){}}"
})
]
I'll see if I can make this work. Thanks for the suggestion 😄
Untill then, this should work:
import autoExternal from 'rollup-plugin-auto-external';
import shim from 'rollup-plugin-shim';
import builtins from 'builtins';
export default {
input: 'index.js',
external: builtins().filter(id => id !== 'readline'),
plugins: [
autoExternal({
builtins: false
}),
shim({
readline: "export default {createInterface(){}}"
})
]
};
I'm thinking about moving the external
option to the root of the options object. I don't think this has to be limited to builtins. What do you think @DrSensor?
plugins: [
autoExternal({
exclude: ['readline']
}),
shim({
readline: "export default {createInterface(){}}"
})
]
For more granular control:
Care to elaborate about this @DrSensor? Do you have a specific use case in mind?