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.2.0 to 3.2.1

23

index.js

@@ -11,2 +11,6 @@ const path = require('path');

function interopEsmDefault(mod) {
return mod && mod.__esModule && mod.default ? mod.default : mod;
}
const virtualModules = new Map();

@@ -30,3 +34,3 @@ let index = 0;

const configPath = path.resolve(process.cwd(), configFile);
const config = require(configPath);
const config = interopEsmDefault(require(configPath));
let found = false;

@@ -61,3 +65,3 @@ if (Array.isArray(config)) {

function getMajor() {
return Number(svelte.VERSION.split('.')[0])
return Number(svelte.VERSION.split('.')[0]);
}

@@ -135,3 +139,3 @@

if (!js.map.sourcesContent) {
if (js.map && !js.map.sourcesContent) {
js.map.sourcesContent = [source];

@@ -147,3 +151,4 @@ js.map.sources = [compileOptions.filename];

if (options.hotReload && !isProduction && !isServer) {
// svelte-hmr has no Svelte 5 support
if (options.hotReload && !isProduction && !isServer && getMajor() < 5) {
const hotOptions = { ...options.hotOptions };

@@ -158,3 +163,5 @@ const makeHot = buildMakeHot(hotOptions);

const cssPath = `${resource}.${index++}.css`;
css.code += '\n/*# sourceMappingURL=' + css.map.toUrl() + '*/';
if (css.map) {
css.code += '\n/*# sourceMappingURL=' + css.map.toUrl() + '*/';
}
js.code += `\nimport '${cssPath}!=!svelte-loader?cssPath=${cssPath}!${resource}'\n;`;

@@ -174,4 +181,8 @@ virtualModules.set(cssPath, css.code);

// context when logging to console
callback(new Error(`${err.name}: ${err.toString()}`));
let err_str = err.toString();
if (getMajor() < 5 || !err_str.startsWith('CompileError:')) {
err_str = `${err.name}: ${err_str}`
}
callback(new Error(err_str));
});
};
{
"name": "svelte-loader",
"version": "3.2.0",
"version": "3.2.1",
"author": "Nico Rehwaldt <git_nikku@nixis.de>",

@@ -29,3 +29,3 @@ "description": "A webpack loader for svelte",

"sinon-chai": "^3.5.0",
"svelte": "^3.0.0"
"svelte": "^4.0.0"
},

@@ -32,0 +32,0 @@ "peerDependencies": {

@@ -29,4 +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'],
conditionNames: ['svelte', 'browser', 'import']
mainFields: ['svelte', 'browser', '...'],
conditionNames: ['svelte', 'browser', '...'],
},

@@ -36,4 +36,14 @@ module: {

...
// This is only needed if you use Svelte 5+ with TypeScript
{
test: /\.(html|svelte)$/,
test: /\.svelte\.ts$/,
use: ['ts-loader', 'svelte-loader']
},
{
// Svelte 5+:
test: /\.(svelte|svelte\.js)$/,
// Svelte 3 or 4:
// test: /\.svelte$/,
// In case you write Svelte in HTML (not recommended since Svelte 3):
// test: /\.(html|svelte)$/,
use: 'svelte-loader'

@@ -81,3 +91,3 @@ },

{
test: /\.(html|svelte)$/,
test: /\.(svelte|svelte\.js)$/,
use: {

@@ -209,2 +219,4 @@ loader: 'svelte-loader',

> Hot Module Reloading is currently not supported for Svelte 5+
This loader supports component-level HMR via the community supported [svelte-hmr](https://github.com/rixo/svelte-hmr) package. This package serves as a testbed and early access for Svelte HMR, while we figure out how to best include HMR support in the compiler itself (which is tricky to do without unfairly favoring any particular dev tooling). Feedback, suggestion, or help to move HMR forward is welcomed at [svelte-hmr](https://github.com/rixo/svelte-hmr/issues) (for now).

@@ -226,3 +238,3 @@

{
test: /\.(html|svelte)$/,
test: /\.(svelte|svelte\.js)$/,
use: {

@@ -319,3 +331,3 @@ loader: 'svelte-loader',

{
test: /\.(html|svelte)$/,
test: /\.(svelte|svelte\.js)$/,
use: {

@@ -322,0 +334,0 @@ loader: 'svelte-loader',

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