@@ -10,6 +10,7 @@ import coffeescript from "rollup-plugin-coffee-script";
1010import json from "@rollup/plugin-json" ;
1111import cssOnly from "rollup-plugin-css-only" ;
1212import babel from "@rollup/plugin-babel" ;
13+ import { wasm } from '@rollup/plugin-wasm' ;
1314
1415export type Plugin =
1516 | "js"
@@ -18,11 +19,13 @@ export type Plugin =
1819 | "json"
1920 | "css"
2021 | "babel"
22+ | "wasm"
2123 | [ "ts" , typeof typescript ]
2224 | [ "babel" , typeof babel ]
2325 | [ "coffee" , typeof coffeescript ]
2426 | [ "json" , typeof json ]
25- | [ "css" , typeof cssOnly ] ;
27+ | [ "css" , typeof cssOnly ]
28+ | [ "wasm" , typeof wasm ] ;
2629
2730// function to check if the first array has any of the second array
2831// first array can have `[string, object]` as their input
@@ -164,6 +167,19 @@ export function createPlugins(
164167 }
165168 }
166169
170+ // wasm
171+ const wasmIndex = includesAny ( inputPluginsNames , [ "wasm" , "WebAssembly" ] ) ;
172+ if ( wasmIndex !== null ) {
173+ const wasm = require ( "@rollup/plugin-wasm" ) ;
174+ if ( typeof inputPluginsNames [ wasmIndex ] === "string" ) {
175+ // plugin name only
176+ plugins . push ( wasm ( ) ) ;
177+ } else {
178+ // plugin with options
179+ plugins . push ( wasm ( inputPluginsNames [ wasmIndex ] [ 1 ] ) ) ;
180+ }
181+ }
182+
167183 // extra plugins
168184 if ( typeof extraPlugins !== "boolean" && extraPlugins !== undefined ) {
169185 try {
0 commit comments