Renaming `transformInclude` to `when`
See original GitHub issueI think it will give another DX:
const plugin = defineUnplugin({
name: 'my-first-unplugin',
setup(options: UserOptions) {
return {
// webpack's id filter is outside of loader logic,
// an additional hook is needed for better perf on webpack
when (id) {
return id.endsWith('.vue')
},
// just like rollup transform
transform (code) {
return code.replace(/<template>/, `<template><div>Injected</div>`)
},
// more hooks incoming
}
}
})
Also, filter
could also work, feedback welcome @pi0 @danielroe @antfu
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Plugin API - Vite
Virtual modules are a useful scheme that allows you to pass build time information to the source files using normal ESM import syntax....
Read more >vite/CHANGELOG.md at main · vitejs/vite - GitHub
@vitejs/plugin-react-swc is a new plugin that uses esbuild during build, but replaces Babel with SWC during development. For big projects that don't require...
Read more >TRANSFORM Subcommand (MANOVA: Multivariate command) - IBM
If you do not use the RENAME subcommand with TRANSFORM , the variables specified on TRANSFORM are renamed temporarily (for the duration of...
Read more >RE: identity transform - include CDATA's, etc - Stylus Studio
RE: identity transform - include CDATA's, etc. ... Re: document() for opening mu, Vitaly Ostanin, Date · Re: Rename attributes and nod, ...
Read more >babel-plugin-transform-es2015-modules-reify - npm
Benefits of this transform include: Imported variables are never renamed or turned into property lookups, so you can inspect your imports easily in...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I think transformInclude or any name has transform inside shouldTransform makes better sense since goal is not solely a unified transformer.
In that case if we need to keep
transform
as prefix,transformInclude
looks best 😅 we