Socket
Socket
Sign inDemoInstall

svelte-loader

Package Overview
Dependencies
Maintainers
4
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.5 to 3.1.6

26

index.js

@@ -1,2 +0,2 @@

const { relative } = require('path');
const path = require('path');
const { getOptions } = require('loader-utils');

@@ -13,2 +13,24 @@ const { buildMakeHot } = require('./lib/make-hot.js');

let configFile = 'webpack.config.js';
for (let i = 0; i < process.argv.length; i++) {
if (process.argv[i] === '--config') {
configFile = process.argv[i + 1];
break;
}
if (process.argv[i].startsWith('--config=')) {
configFile = process.argv[i].split('=')[1];
break;
}
}
try {
const config = require(path.resolve(process.cwd(), configFile));
if (!config.resolve || !config.resolve.conditionNames || !config.resolve.conditionNames.includes('svelte')) {
console.warn('\n\u001B[1m\u001B[31mWARNING: You should add "svelte" to the "resolve.conditionNames" array in your webpack config. See https://github.com/sveltejs/svelte-loader#resolveconditionnames for more information\u001B[39m\u001B[22m\n');
}
} catch (e) {
// do nothing and hope for the best
}
module.exports = function(source, map) {

@@ -68,3 +90,3 @@ this.cacheable();

const makeHot = buildMakeHot(hotOptions);
const id = JSON.stringify(relative(process.cwd(), compileOptions.filename));
const id = JSON.stringify(path.relative(process.cwd(), compileOptions.filename));
js.code = makeHot(id, js.code, hotOptions, compiled, source, compileOptions);

@@ -71,0 +93,0 @@ }

@@ -0,0 +0,0 @@ import { makeApplyHmr } from 'svelte-hmr/runtime';

@@ -0,0 +0,0 @@ const { walk } = require('svelte/compiler');

@@ -0,0 +0,0 @@ Copyright (c) 2016-21 [these people](https://github.com/sveltejs/svelte-loader/graphs/contributors)

2

package.json
{
"name": "svelte-loader",
"version": "3.1.5",
"version": "3.1.6",
"author": "Nico Rehwaldt <git_nikku@nixis.de>",

@@ -5,0 +5,0 @@ "description": "A webpack loader for svelte",

@@ -29,3 +29,4 @@ > 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/).

extensions: ['.mjs', '.js', '.svelte'],
mainFields: ['svelte', 'browser', 'module', 'main']
mainFields: ['svelte', 'browser', 'module', 'main'],
conditionNames: ['svelte']
},

@@ -60,4 +61,8 @@ module: {

Webpack's [`resolve.mainFields`](https://webpack.js.org/configuration/resolve/#resolve-mainfields) option determines which fields in package.json are used to resolve identifiers. If you're using Svelte components installed from npm, you should specify this option so that your app can use the original component source code, rather than consuming the already-compiled version (which is less efficient).
Webpack's [`resolve.mainFields`](https://webpack.js.org/configuration/resolve/#resolve-mainfields) option determines which fields in `package.json` are used to resolve identifiers. If you're using Svelte components installed from npm, you should specify this option so that your app can use the original component source code, rather than consuming the already-compiled version (which is less efficient).
### resolve.conditionNames
Webpack's [`resolve.conditionNames`](https://webpack.js.org/configuration/resolve/#resolveconditionnames) option determines which fields in the `exports` in `package.json` are used to resolve identifiers. If you're using Svelte components installed from npm, you should specify this option so that your app can use the original component source code, rather than consuming the already-compiled version (which is less efficient).
### Extracting CSS

@@ -64,0 +69,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