From e8217efec2487c6002bdf8b4db8e2a8b10cb4d39 Mon Sep 17 00:00:00 2001 From: Marcin Kulik Date: Thu, 2 Mar 2023 16:45:13 +0100 Subject: [PATCH] Remove workaround for import.meta.url bug in bundler --- rollup.config.mjs | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/rollup.config.mjs b/rollup.config.mjs index 33b45912..ec63bc4e 100644 --- a/rollup.config.mjs +++ b/rollup.config.mjs @@ -2,21 +2,6 @@ import babel from "@rollup/plugin-babel"; import resolve from "@rollup/plugin-node-resolve"; import rust from "@wasm-tool/rollup-plugin-rust"; -function removeImportMetaUrl() { - // This plugin replaces import.meta.url with an empty string. Why? - // wasm-bindgen produces a wasm loading code having reference to - // import.meta.url, which becomes a dead code given rust plugin inlines the - // wasm blob, while import.meta.url causes bundling issues with popular - // bundlers (or requires plugins). - - return { - resolveImportMeta(property, {moduleId}) { - if (property === 'url') { return "''" } - return null; - } - } -} - const plugins = [ babel({ exclude: "node_modules/**", @@ -25,8 +10,7 @@ const plugins = [ plugins: [['@babel/transform-runtime']] }), rust({ inlineWasm: true, wasmOptArgs: ["-O4"] }), - resolve({ extensions: [".js", ".jsx"] }), - removeImportMetaUrl() + resolve({ extensions: [".js", ".jsx"] }) ]; export default {