Skip to content

SourceMap breaks when using vite-plugin-conditional-compile #5

Description

@f4-miyata

Bug Description
When using vite-plugin-conditional-compile, the sourcemap is broken. This issue occurs in the following environment:

  • Vite version: 5.2.6
  • vite-plugin-conditional-compile version: 1.4.4
  • Operating System: macOS
  • Node version: 20.10.0
  • Package manager pnpm: 8.15.5

Reproduction
Unfortunately, I cannot provide a link to a repo that can reproduce the problem due to the proprietary nature of the project. However, the issue arises when using the vite-plugin-conditional-compile in the Vite configuration file.

Steps to Reproduce

  1. Open the Vite configuration file (vite.config.ts).
  2. In the configuration file, set sourcemap: true.
  3. Build or run the project.
  4. Check the index-xxx.js.map file. At this point, you can confirm that the contents of the file are corrupted.

Config

// excerpt from `vite.config.ts`
plugins: [
  vitePluginConditionalCompile({
    exclude: [
      ...,
    ],
    env: {
      DEV: mode === 'development',
    },
  }),
  ...,
],
...,
build: {
  ..., 
  sourcemap: true,

Thank you so much for creating this plugin. The plugin you've created is extremely valuable to our project and has been of great help. We deeply appreciate your effort and contribution.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions