Skip to content
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

User's exclude config maybe cause Vite's pre-bundled file's sourcemap missing #742

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Expand Up @@ -395,7 +395,8 @@ Components({
// Allow for components to override other components with the same name
allowOverrides: false,

// filters for transforming targets
// Filters for transforming targets
// Your filters config will merge into default config
include: [/\.vue$/, /\.vue\?vue/],
exclude: [/[\\/]node_modules[\\/]/, /[\\/]\.git[\\/]/, /[\\/]\.nuxt[\\/]/],

Expand Down
7 changes: 5 additions & 2 deletions src/core/unplugin.ts
Expand Up @@ -12,9 +12,12 @@ import { shouldTransform, stringifyComponentImport } from './utils'
const PLUGIN_NAME = 'unplugin:webpack'

export default createUnplugin<Options>((options = {}) => {
const include = Array.isArray(options.include) ? options.include : [options.include]
const exclude = Array.isArray(options.exclude) ? options.exclude : [options.exclude]

const filter = createFilter(
options.include || [/\.vue$/, /\.vue\?vue/, /\.vue\?v=/],
options.exclude || [/[\\/]node_modules[\\/]/, /[\\/]\.git[\\/]/, /[\\/]\.nuxt[\\/]/],
[/\.vue$/, /\.vue\?vue/, /\.vue\?v=/, ...include],
[/[\\/]node_modules[\\/]/, /[\\/]\.git[\\/]/, /[\\/]\.nuxt[\\/]/, ...exclude],
)
const ctx: Context = new Context(options)

Expand Down