Package Exports
- snowpack-plugin-selective-import-to-require
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (snowpack-plugin-selective-import-to-require) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
snowpack-plugin-selective-import-to-require
Selectively convert import calls into require calls. Useful for running snowpack with Electron.
npm install --save-dev snowpack-plugin-selective-import-to-require// snowpack.config.json
module.exports = {
"plugins": [
[
"snowpack-plugin-selective-import-to-require",
{
"modules": ["os", "child_process"],
"types": ['.js'],
}
]
]
}Plugin Options
| Name | Type | Description |
|---|---|---|
modules |
string[] |
An array of module names to match against, such as ['os', 'child_process']. |
types |
string[] |
(optional) By default, this plugin matches against ['.js']. Provide an array if you need to match other extensions. |
Match Built-in Node Modules
It may be convenient to match all built-in node modules.
npm install builtin-modules --save-dev// snowpack.config.json
const builtinModules = require('builtin-modules')
module.exports = {
"plugins": [
[
"snowpack-plugin-selective-import-to-require",
{
"modules": builtinModules,
"types": ['.js'],
}
]
],
"packageOptions": {
"external": builtinModules
},
}