pnp-webpack-plugin
Advanced tools
Comparing version 1.5.0 to 1.6.0
16
index.js
@@ -71,2 +71,7 @@ const path = require(`path`); | ||
resolver.getHook(`after-module`).tapAsync(`PnpResolver`, (request, resolveContext, callback) => { | ||
// rethrow pnp errors if we have any for this request | ||
return callback(resolveContext.pnpErrors && resolveContext.pnpErrors.get(request.context.issuer)); | ||
}); | ||
// Register a plugin that will resolve bare imports into the package location on the filesystem before leaving the rest of the resolution to Webpack | ||
@@ -98,3 +103,12 @@ resolver.getHook(`before-module`).tapAsync(`PnpResolver`, (requestContext, resolveContext, callback) => { | ||
} catch (error) { | ||
return callback(error); | ||
if (resolveContext.missingDependencies) | ||
resolveContext.missingDependencies.add(requestContext.path); | ||
if (resolveContext.log) | ||
resolveContext.log(error.message); | ||
resolveContext.pnpErrors = resolveContext.pnpErrors || new Map(); | ||
resolveContext.pnpErrors.set(issuer, error); | ||
return callback(); | ||
} | ||
@@ -101,0 +115,0 @@ |
{ | ||
"name": "pnp-webpack-plugin", | ||
"version": "1.5.0", | ||
"version": "1.6.0", | ||
"description": "plug'n'play resolver for Webpack", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -50,41 +50,2 @@ # <img src="https://raw.githubusercontent.com/webpack/media/master/logo/icon-square-small.png" height="40" align="right" /> [Plug'n'Play](https://github.com/yarnpkg/rfcs/pull/101) resolver for Webpack | ||
### `ts-loader` integration | ||
This plugin as an integration to easily add support for TypeScript in your applications through `ts-loader`. In order to do this, just do the following: | ||
```js | ||
const PnpWebpackPlugin = require(`pnp-webpack-plugin`); | ||
module.exports = { | ||
module: { | ||
rules: [{ | ||
test: /\.ts$/, | ||
loader: require.resolve('ts-loader'), | ||
options: PnpWebpackPlugin.tsLoaderOptions({ | ||
// ... regular options go there ... | ||
}), | ||
}], | ||
}, | ||
}; | ||
``` | ||
If you have any options you want to pass to `ts-loader`, just pass them as parameter of the `tsLoaderOptions` function and it will take care of forwarding them properly. | ||
## `fork-ts-checker-webpack-plugin` integration | ||
We also provide an integration for `fork-ts-checker-webpack-plugin`, in a similar way to what we do with `ts-loader`. Here's an example: | ||
```js | ||
const ForkTsCheckerWebpackPlugin = require(`fork-ts-checker-webpack-plugin`); | ||
const PnpWebpackPlugin = require(`pnp-webpack-plugin`); | ||
module.exports = { | ||
plugins: [ | ||
new ForkTsCheckerWebpackPlugin(PnpWebpackPlugin.forkTsCheckerOptions({ | ||
// ... regular options go there ... | ||
}), | ||
], | ||
}; | ||
``` | ||
## License (MIT) | ||
@@ -91,0 +52,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
190
11737
59