svelte-loader
Advanced tools
+2
-2
@@ -76,7 +76,7 @@ const path = require('path'); | ||
| filename: this.resourcePath, | ||
| css: !options.emitCss, | ||
| css: VERSION[0] === '3' ? !options.emitCss : (options.emitCss ? 'external' : 'injected'), | ||
| ...options.compilerOptions | ||
| }; | ||
| if (VERSION[0] === '3') { | ||
| compileOptions.format = (options.compilerOptions && options.compilerOptions.format) || 'esm' | ||
| compileOptions.format = (options.compilerOptions && options.compilerOptions.format) || 'esm'; | ||
| } else { | ||
@@ -83,0 +83,0 @@ if (options.compilerOptions && options.compilerOptions.format && !warned) { |
+2
-2
| { | ||
| "name": "svelte-loader", | ||
| "version": "3.1.8", | ||
| "version": "3.1.9", | ||
| "author": "Nico Rehwaldt <git_nikku@nixis.de>", | ||
@@ -32,3 +32,3 @@ "description": "A webpack loader for svelte", | ||
| "peerDependencies": { | ||
| "svelte": "^3.0.0 || 4.0.0-next.0 || 4.0.0-next.1 || ^4.0.0" | ||
| "svelte": "^3.0.0 || ^4.0.0-next.0" | ||
| }, | ||
@@ -35,0 +35,0 @@ "repository": { |
+23
-5
@@ -25,8 +25,8 @@ > Undecided yet what bundler to use? We suggest using [SvelteKit](https://kit.svelte.dev), or Vite with [vite-plugin-svelte](https://github.com/sveltejs/vite-plugin-svelte/). | ||
| // see below for an explanation | ||
| alias: { | ||
| svelte: path.resolve('node_modules', 'svelte') | ||
| }, | ||
| // alias: { | ||
| // svelte: path.resolve('node_modules', 'svelte/src/runtime') // Svelte 3: path.resolve('node_modules', 'svelte') | ||
| // }, | ||
| extensions: ['.mjs', '.js', '.svelte'], | ||
| mainFields: ['svelte', 'browser', 'module', 'main'], | ||
| conditionNames: ['svelte', 'browser'] | ||
| conditionNames: ['svelte', 'browser', 'import'] | ||
| }, | ||
@@ -57,3 +57,3 @@ module: { | ||
| The [`resolve.alias`](https://webpack.js.org/configuration/resolve/#resolvealias) option is used to make sure that only one copy of the Svelte runtime is bundled in the app, even if you are `npm link`ing in dependencies with their own copy of the `svelte` package. Having multiple copies of the internal scheduler in an app, besides being inefficient, can also cause various problems. | ||
| The [`resolve.alias`](https://webpack.js.org/configuration/resolve/#resolvealias) option is used to make sure that only one copy of the Svelte runtime is bundled in the app, even if you are `npm link`ing in dependencies with their own copy of the `svelte` package. Having multiple copies of the internal scheduler in an app, besides being inefficient, can also cause various problems. It's commented out because you rarely should need this and it's brittle since it relies on the internal structure of the Svelte package, which can change. | ||
@@ -188,2 +188,20 @@ ### resolve.mainFields | ||
| ### Using preprocessors like TypeScript | ||
| Install [svelte-preprocess](https://github.com/sveltejs/svelte-preprocess) and add it to the loader options: | ||
| ```js | ||
| const sveltePreprocess = require('svelte-preprocess'); | ||
| ... | ||
| use: { | ||
| loader: 'svelte-loader', | ||
| options: { | ||
| preprocess: sveltePreprocess() | ||
| }, | ||
| }, | ||
| ... | ||
| ``` | ||
| Now you can use other languages inside the script and style tags. Make sure to install the respective transpilers and add a `lang` tag indicating the language that should be preprocessed. In the case of TypeScript, install `typescript` and add `lang="ts"` to your script tags. | ||
| ### Hot Reload | ||
@@ -190,0 +208,0 @@ |
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
21742
4.28%380
4.97%