Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions .cspell.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
{
"version": "0.2",
"language": "en,en-gb",
"words": ["memfs", "sokra", "Koppers", "commitlint"],

"words": [
"memfs",
"sokra",
"Koppers",
"commitlint",
"eslintcache",
"cspellcache"
],
"ignorePaths": [
"CHANGELOG.md",
"package.json",
Expand Down
4 changes: 0 additions & 4 deletions .eslintignore

This file was deleted.

4 changes: 0 additions & 4 deletions .eslintrc.js

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ logs
*.log
npm-debug.log*
.eslintcache
.cspellcache
/coverage
/dist
/local
Expand Down
44 changes: 25 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,7 @@ import myLib from "imports-loader?imports=named|library|myMethod,angular!./examp
```

```js
const myLib = require(
`imports-loader?type=commonjs&imports=single|jquery|$,angular!./example.js`,
);
const myLib = require("imports-loader?type=commonjs&imports=single|jquery|$,angular!./example.js");
// `|` is separator in a query string, equivalently `single|jquery|$` and `angular`
// Adds the following code to the beginning of example.js:
//
Expand All @@ -124,9 +122,7 @@ const myLib = require(
```

```js
const myLib = require(
`imports-loader?type=commonjs&imports=single|myLib|myMethod&wrapper=window&!./example.js`,
);
const myLib = require("imports-loader?type=commonjs&imports=single|myLib|myMethod&wrapper=window&!./example.js");
// `|` is separator in a query string, equivalently `single|myLib|myMethod` and `angular`
// Adds the following code to the example.js:
//
Expand Down Expand Up @@ -190,13 +186,15 @@ module.exports = {

Generate output:

<!-- eslint-skip -->

```js
import angular from "angular";
import $ from "jquery";
import lib_2_default from "lib_2";
import { lib2_method_1, lib2_method_2 as lib_2_method_2_short } from "lib_3";
import * as my_namespace from "lib_4";
import "lib_5";
import angular from "angular";
```

Finally, run `webpack` using the method you normally use (e.g., via CLI or an npm script).
Expand Down Expand Up @@ -250,7 +248,7 @@ module.exports = {
Generate output:

```js
var Foo = require("Foo");
const Foo = require("Foo");

// ...
// Code
Expand Down Expand Up @@ -308,7 +306,7 @@ type imports =
name: string;
alias: string;
}
| Array<
| (
| string
| {
syntax:
Expand All @@ -323,7 +321,7 @@ type imports =
name: string;
alias: string;
}
>;
)[];
```

Default: `undefined`
Expand All @@ -341,7 +339,6 @@ The `|` or `%20` (space) allow to separate the `syntax`, `moduleName`, `name` an
String syntax - `[[syntax] [moduleName] [name] [alias]]` or `[[syntax]|[moduleName]|[name]|[alias]]`, where:

- `[syntax]` (**may be omitted**):

- if `type` is `module`- can be `default`, `named`, `namespace` or `side-effects`, the default value is `default`.
- if `type` is `commonjs`- can be `single`, `multiple` or `pure`, the default value is `single`.

Expand Down Expand Up @@ -433,7 +430,7 @@ module.exports = {
Generate output:

```js
var myName = require("lib");
const myName = require("lib");

// ...
// Code
Expand All @@ -447,7 +444,6 @@ Allows to use an object to describe an import.
Properties:

- `syntax`:

- if `type` is `module`- can be `default`, `named`, `namespace` or `side-effects`
- if `type` is `commonjs`- can be `single`, `multiple` or `pure`

Expand Down Expand Up @@ -543,6 +539,8 @@ module.exports = {

Generate output:

<!-- eslint-skip -->

```js
import angular from "angular";
import $ from "jquery";
Expand All @@ -566,7 +564,7 @@ type wrapper =
| string
| {
thisArg: string;
args: Record<string, string> | Array<string>;
args: Record<string, string> | string[];
};
```

Expand Down Expand Up @@ -610,6 +608,8 @@ module.exports = {

Generate output:

<!-- eslint-skip -->

```js
import $ from "jquery";

Expand Down Expand Up @@ -652,14 +652,16 @@ module.exports = {

Generate output:

<!-- eslint-skip -->

```js
import $ from "jquery";

(function () {
// ...
// Code
// ...
}).call(window);
}).call(globalThis);
```

#### `object`
Expand Down Expand Up @@ -697,14 +699,16 @@ module.exports = {

Generate output:

<!-- eslint-skip -->

```js
import $ from "jquery";

(function (myVariable, myOtherVariable) {
// ...
// Code
// ...
}).call(window, myVariable, myOtherVariable);
}).call(globalThis, myVariable, myOtherVariable);
```

#### `object` with different parameter names
Expand Down Expand Up @@ -745,14 +749,16 @@ module.exports = {

Generate output:

<!-- eslint-skip -->

```js
import $ from "jquery";

(function (var1, var2) {
// ...
// Code
// ...
}).call(window, myVariable, myOtherVariable);
}).call(globalThis, myVariable, myOtherVariable);
```

### `additionalCode`
Expand Down Expand Up @@ -802,7 +808,7 @@ Generate output:
```js
import $ from "jquery";

var myVariable = false;
const myVariable = false;

// ...
// Code
Expand Down Expand Up @@ -843,7 +849,7 @@ Generate output:
```js
import $ from "jquery";

var define = false; /* Disable AMD for misbehaving libraries */
const define = false; /* Disable AMD for misbehaving libraries */

// ...
// Code
Expand Down
8 changes: 8 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { defineConfig } from "eslint/config";
import configs from "eslint-config-webpack/configs.js";

export default defineConfig([
{
extends: [configs["recommended-dirty"]],
},
]);
Loading
Loading