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.6 to 3.1.7

25

index.js
const path = require('path');
const fs = require('fs');
const { getOptions } = require('loader-utils');

@@ -27,6 +28,26 @@ const { buildMakeHot } = require('./lib/make-hot.js');

try {
const config = require(path.resolve(process.cwd(), configFile));
if (!config.resolve || !config.resolve.conditionNames || !config.resolve.conditionNames.includes('svelte')) {
const configPath = path.resolve(process.cwd(), configFile);
const config = require(configPath);
let found = false;
if (Array.isArray(config)) {
found = config.some(check);
} else {
found = check(config);
}
if (!found) {
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');
}
function check(config) {
if (typeof config === 'function') {
// We could try to invoke it but that could maybe have side unintended side effects
// and/or fail due to missing parameters, so we read the file instead
const configString = fs.readFileSync(configPath, 'utf-8');
const result = /conditionNames\s*:[\s|\n]*\[([^\]]+?)\]/.exec(configString);
return !!result && !!result[1].includes('svelte');
} else {
return !!config.resolve && !!config.resolve.conditionNames && config.resolve.conditionNames.includes('svelte');
}
}
} catch (e) {

@@ -33,0 +54,0 @@ // do nothing and hope for the best

@@ -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.6",
"version": "3.1.7",
"author": "Nico Rehwaldt <git_nikku@nixis.de>",

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

@@ -0,0 +0,0 @@ > 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/).

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