webpack.js.org
webpack.js.org copied to clipboard
Document webpack change: refactor: migrate on `acorn-import-attributes`
A pull request by @alexander-akait was merged and maintainers requested a documentation change.
See pull request: https://github.com/webpack/webpack/pull/18251
What kind of change does this PR introduce?
https://github.com/xtuc/acorn-import-attributes/pull/31/
Did you add tests for your changes?
Existing
Does this PR introduce a breaking change?
No
What needs to be documented once your changes are merged?
Added with ruleset rule, like assert, i.e.:
/** @type {import("../../../../").Configuration} */
module.exports = {
module: {
rules: [
{
// will handle `pkg-1.json`
assert: { type: "json" },
loader: require.resolve("./loader-assert.js")
},
{
// will handle `pkg-2.json`
with: { type: "json" },
loader: require.resolve("./loader-with.js")
}
]
}
};
```js
import one from "./pkg-1.json" assert { type: "json" };
import two from "./pkg-2.json" with { type: "json" };