svelte-preprocess
Advanced tools
Comparing version 2.15.2 to 2.16.0
@@ -0,1 +1,5 @@ | ||
# [2.16.0](https://github.com/kaisermann/svelte-preprocess/compare/v2.15.2...v2.16.0) (2019-08-28) | ||
## [2.15.2](https://github.com/kaisermann/svelte-preprocess/compare/v2.15.0...v2.15.2) (2019-08-28) | ||
@@ -2,0 +6,0 @@ |
{ | ||
"name": "svelte-preprocess", | ||
"version": "2.15.2", | ||
"version": "2.16.0", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -380,2 +380,8 @@ # Svelte Preprocess | ||
}, | ||
/** | ||
* Type checking can be skipped by setting 'transpileOnly: true'. | ||
* This speeds up your build process. | ||
*/ | ||
transpileOnly: true, | ||
}, | ||
@@ -426,1 +432,23 @@ | ||
If you have configured `svelte-preprocess` to use some kind of preprocessor and `svelte-vscode` is displaying errors like it's ignoring your preprocess configuration, that's happening because `svelte-vscode` needs to know how to preprocess your components. `svelte-vscode` works by having a svelte compiler running on the background and you can configure it by [creating a `svelte.config.js`](#with-svelte-vs-code) file on your project's root. Please check this document [With Svelte VS Code](#with-svelte-vs-code) section. | ||
### My `typescript` compilation is sloooooooow | ||
If you have a medium-to-big project, the typescript processor might start to get slow. If you already have an IDE type checking your code, you can speed up the transpilation process by setting `transpileOnly` to `true`: | ||
```js | ||
const preprocess = require('svelte-preprocess') | ||
... | ||
{ | ||
...svelteOptions, | ||
preprocess: preprocess({ | ||
typescript: { | ||
// skips type checking | ||
transpileOnly: true, | ||
compilerOptions: { | ||
... | ||
}, | ||
}, | ||
}) | ||
} | ||
... | ||
``` |
@@ -198,6 +198,19 @@ const ts = require('typescript') | ||
const { code, map, diagnostics } = compileFileFromMemory(compilerOptions, { | ||
filename, | ||
content, | ||
}) | ||
let code, map, diagnostics | ||
if (options.transpileOnly || compilerOptions.transpileOnly) { | ||
;({ | ||
outputText: code, | ||
sourceMapText: map, | ||
diagnostics, | ||
} = ts.transpileModule(content, { | ||
fileName: filename, | ||
compilerOptions: compilerOptions, | ||
reportDiagnostics: options.reportDiagnostics !== false, | ||
})) | ||
} else { | ||
;({ code, map, diagnostics } = compileFileFromMemory(compilerOptions, { | ||
filename, | ||
content, | ||
})) | ||
} | ||
@@ -204,0 +217,0 @@ if (diagnostics.length > 0) { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
44257
771
453