Socket
Socket
Sign inDemoInstall

imports-loader

Package Overview
Dependencies
Maintainers
3
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

imports-loader - npm Package Compare versions

Comparing version 0.6.5 to 0.7.0

LICENSE

14

index.js

@@ -28,2 +28,16 @@ /*

postfixes.unshift("}.call(" + value + "));");
} else if(name.indexOf(".") !== -1) {
name.split(".").reduce(function(previous, current, index, names) {
var expr = previous + current;
if(previous.length === 0) {
imports.push("var " + expr + " = (" + current + " || {});");
} else if(index < names.length-1) {
imports.push(expr + " = {};");
} else {
imports.push(expr + " = " + value + ";");
}
return previous + current + ".";
}, "");
} else {

@@ -30,0 +44,0 @@ imports.push("var " + name + " = " + value + ";");

17

package.json
{
"name": "imports-loader",
"version": "0.6.5",
"version": "0.7.0",
"author": "Tobias Koppers @sokra",
"description": "imports loader module for webpack",
"scripts": {
"test": "mocha",
"travis": "npm run -s test"
},
"dependencies": {
"loader-utils": "0.2.x",
"source-map": "0.1.x"
"loader-utils": "^0.2.16",
"source-map": "^0.5.6"
},
"devDependencies": {
"mocha": "^3.1.2",
"should": "^11.1.1"
},
"files": [
"index.js"
],
"license": "MIT",

@@ -11,0 +22,0 @@ "repository": {

17

README.md
# imports loader for webpack
Can be used to inject variables into the scope of a module. This is especially useful if third-party modules are relying on global variables like `$` or `this` being the `window` object.
The imports loader allows you to use modules that depend on specific global variables.
This is useful for third-party modules that rely on global variables like `$` or `this` being the `window` object. The imports loader can add the necessary `require('whatever')` calls, so those modules work with webpack.
## Installation

@@ -22,3 +24,3 @@

``` javascript
require("imports?$=jquery!./example.js");
require("imports-loader?$=jquery!./example.js");
```

@@ -43,3 +45,3 @@

```javascript
require("imports?$=jquery,angular,config=>{size:50}!./file.js");
require("imports-loader?$=jquery,angular,config=>{size:50}!./file.js");
```

@@ -60,5 +62,6 @@

test: require.resolve("some-module"),
loader: "imports?this=>window"
loader: "imports-loader?this=>window"
}
]
}
};

@@ -73,7 +76,7 @@ ```

`imports?$=jquery`
`imports-loader?$=jquery`
### Custom Angular modules
`imports?angular`
`imports-loader?angular`

@@ -87,3 +90,3 @@ ### Disable AMD

```javascript
imports?define=>false
imports-loader?define=>false
```

@@ -90,0 +93,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