question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Renaming `transformInclude` to `when`

See original GitHub issue

I 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:closed
  • Created 2 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
pi0commented, Jul 12, 2021

I think transformInclude or any name has transform inside shouldTransform makes better sense since goal is not solely a unified transformer.

0reactions
Atinuxcommented, Jul 12, 2021

In that case if we need to keep transform as prefix, transformInclude looks best 😅 we

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found