1.1.6 • Published 3 years ago
@snowpack/babel-plugin-package-import v1.1.6
@snowpack/babel-plugin-package-import
Babel plugin to rewrite package imports from their package name to their resolved web_modules
URL. Uses the import-map.json
file contained in each web_modules/
directory to map each package.
npm install --save-dev @snowpack/babel-plugin-package-import
// babel.config.json / .babelrc
"plugins": [["@snowpack/babel-plugin-package-import", { /* options */ }]]
Plugin Options
Note: All config options are optional.
webModulesUrl
: The hosted URL path reference for web_modules imports. Can be:- An absolute path ("/web_modules"). This is the default.
- An absolute URL ("https://foobar.com/web_modules/")
- A relative path prefix ("./web_modules", "../web_modules"). NOTE: Relative paths are relative from the current working directory / Babel's "root".
webModulesDir
: The web_modules installed location on disk. Can be an absolute path, or relative to the current working directory.- Defaults to "\${cwd}/web_modules".
importMap
: The name/location of the "import-map.json" file generated by Snowpack.- Defaults to "\${webModulesDir}/import-map.json".
moduleResolution
: Control how the plugin rewrites relative/local imports. Defaults to "none"."none"
: Leave relative imports untouched."node"
: Rewrite all relative paths to use node's built-in resolution, resolving things like missing file extensions and directory imports. This is useful to assist migrating an older, bundled project to Snowpack.
ignore
: Array of import specifiers to ignore and leave untouched / bare.
1.1.6
3 years ago
1.1.5
4 years ago
1.1.4
4 years ago
1.1.3
4 years ago
1.1.2
4 years ago
1.1.1
4 years ago
1.1.0
4 years ago
1.0.0
4 years ago
0.8.0
4 years ago
0.7.0
4 years ago
0.6.1
4 years ago
0.6.0
4 years ago
0.5.0
4 years ago
0.5.1
4 years ago
0.4.0
4 years ago
0.3.0
4 years ago
0.2.6
4 years ago
0.2.4
4 years ago
0.2.0
4 years ago