Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vite-plugin-wasm-pack

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vite-plugin-wasm-pack - npm Package Compare versions

Comparing version 0.1.4 to 0.1.5

8

dist/index.js

@@ -13,2 +13,4 @@ "use strict";

const pkg = 'pkg';
let config_base;
let config_assetsDir;
const cratePaths = narrowing_1.isString(crates) ? [crates] : crates;

@@ -26,2 +28,6 @@ function wasmFilename(cratePath) {

enforce: 'pre',
configResolved(resolvedConfig) {
config_base = resolvedConfig.base;
config_assetsDir = resolvedConfig.build.assetsDir;
},
resolveId(id) {

@@ -65,3 +71,3 @@ for (let i = 0; i < cratePaths.length; i++) {

code = code.replace(regex, (match, group1) => {
return `input = "/assets/${group1}"`;
return `input = "${path_1.default.join(config_base, config_assetsDir, group1)}"`;
});

@@ -68,0 +74,0 @@ fs_extra_1.default.writeFileSync(jsPath, code);

2

package.json
{
"name": "vite-plugin-wasm-pack",
"version": "0.1.4",
"version": "0.1.5",
"description": "wasm-pack for Vite",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -83,2 +83,11 @@ # 🚚 vite-plugin-wasm-pack

Add script to `package.json`
```json
"scripts": {
"dev": "vite",
"build": "vite build"
}
```
⚠ **Don't forget to build your [wasm-pack](https://github.com/rustwasm/wasm-pack) crate first!**

@@ -90,12 +99,13 @@

Add command to `package.json`
Tips: you can add a `wasm` script to `package.json` like this:
```json
"scripts": {
"dev": "vite",
"build": "vite build"
"wasm": "wasm-pack build ./my-crate --target web",
"dev": "yarn wasm && vite",
"build": "vite build"
}
```
Start dev server, and install `my-crate` that you build earlier.
Then, run:

@@ -106,2 +116,4 @@ ```bash

This will start dev server, and install `my-crate` that you built earlier.
## Complete example

@@ -108,0 +120,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc