Socket
Socket
Sign inDemoInstall

svelte-loader

Package Overview
Dependencies
Maintainers
5
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

svelte-loader - npm Package Compare versions

Comparing version 3.1.8 to 3.1.9

4

index.js

@@ -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) {

{
"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": {

@@ -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 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc