@web/rollup-plugin-import-meta-assets
Advanced tools
Comparing version 1.0.0 to 1.0.1
# @web/rollup-plugin-import-meta-assets | ||
## 1.0.1 | ||
### Patch Changes | ||
- fd9fe56: publish files | ||
## 1.0.0 | ||
@@ -4,0 +10,0 @@ |
{ | ||
"name": "@web/rollup-plugin-import-meta-assets", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"publishConfig": { | ||
@@ -26,3 +26,7 @@ "access": "public" | ||
}, | ||
"files": ["dist"], | ||
"files": [ | ||
"*.js", | ||
"*.mjs", | ||
"src" | ||
], | ||
"keywords": [ | ||
@@ -29,0 +33,0 @@ "rollup", |
# Rollup Plugin import-meta-assets | ||
Rollup plugin that detects assets references relative to modules using patterns such as `new URL('./path/to/asset.ext', import.meta.url)`. The assets are added to the rollup pipeline, allowing them to be transformed and hash the filenames. | ||
Rollup plugin that detects assets references relative to modules using patterns such as `new URL('./assets/my-img.png', import.meta.url)`. | ||
The referenced assets are added to the rollup pipeline, allowing them to be transformed and hash the filenames. | ||
## How it works | ||
A common pattern is to import an asset to get the URL of it after bundling: | ||
```js | ||
import myImg from './assets/my-img.png'; | ||
``` | ||
This doesn't work in the browser without transformation. This plugin makes it possible to use an identical pattern using `import.meta.url` which does work in the browser: | ||
```js | ||
const myImg = new URL('./assets/my-img.png', import.meta.url); | ||
``` | ||
## Install | ||
@@ -6,0 +22,0 @@ |
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Empty package
Supply chain riskPackage does not contain any code. It may be removed, is name squatting, or the result of a faulty package publish.
Found 1 instance in 1 package
7107
5
101
51
0
1