Skip to content

Support for array of preprocessors #279

@itsMapleLeaf

Description

@itsMapleLeaf

Describe the bug
import type syntax causes a type error. This is needed for ESM-sensitive bundlers that need to differentiate types from values for erasure during compilation

To Reproduce
Steps to reproduce the behavior:

// svelte.config.js
const preprocess = require("svelte-preprocess")

module.exports = {
	preprocess: [
		preprocess.postcss(),
		preprocess.typescript({ transpileOnly: true }),
	],
}
// types.ts
export type Secret = string
<!-- Component.svelte -->
<script lang="ts">
  import type { Secret } from './types' // type error on this line
  const secret: Secret = '42'
</script>

For example a code snippet that is treated in a way you don't expect.

Expected behavior
Type imports should be parsed without errors

Screenshots
If applicable, add screenshots to help explain your problem.
image

System (please complete the following information):

  • OS: Windows 10
  • IDE: VSCode
  • Plugin/Package: Svelte for VSCode

Metadata

Metadata

Assignees

Labels

FixedFixed in master branch. Pending production release.documentationImprovements or additions to documentationfeature requestNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions