mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-08-03 04:47:21 +02:00
Compare commits
4 Commits
16c876569f
...
0bde69c7bf
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0bde69c7bf | ||
|
|
20e06c4bb5 | ||
|
|
bd06061e85 | ||
|
|
bd418de6b0 |
@ -173,6 +173,36 @@ function babelPluginPDFJSPreprocessor(babel, ctx) {
|
|||||||
path.replaceWith(t.importExpression(source));
|
path.replaceWith(t.importExpression(source));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
NewExpression(path) {
|
||||||
|
const { node } = path;
|
||||||
|
|
||||||
|
if (
|
||||||
|
t.isIdentifier(node.callee, { name: "URL" }) &&
|
||||||
|
node.arguments.length === 2
|
||||||
|
) {
|
||||||
|
const [arg1, arg2] = node.arguments;
|
||||||
|
|
||||||
|
if (
|
||||||
|
arg1.type === "StringLiteral" &&
|
||||||
|
arg1.value.endsWith(".wasm") &&
|
||||||
|
arg2.type === "MemberExpression"
|
||||||
|
) {
|
||||||
|
// This statement is generated by the Emscripten Compiler (emcc),
|
||||||
|
// however we're manually loading wasm-files and we want to ensure
|
||||||
|
// that bundlers will leave it alone; this *must* include Webpack.
|
||||||
|
arg1.leadingComments = [
|
||||||
|
{
|
||||||
|
type: "CommentBlock",
|
||||||
|
value: "webpackIgnore: true",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "CommentBlock",
|
||||||
|
value: "@vite-ignore",
|
||||||
|
},
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"BlockStatement|StaticBlock": {
|
"BlockStatement|StaticBlock": {
|
||||||
// Visit node in post-order so that recursive flattening
|
// Visit node in post-order so that recursive flattening
|
||||||
// of blocks works correctly.
|
// of blocks works correctly.
|
||||||
|
|||||||
4
external/builder/fixtures_babel/ignore-expected.js
vendored
Normal file
4
external/builder/fixtures_babel/ignore-expected.js
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
const wasmUrl = new URL(
|
||||||
|
/*webpackIgnore: true*/
|
||||||
|
/*@vite-ignore*/
|
||||||
|
"qwerty.wasm", import.meta.url);
|
||||||
1
external/builder/fixtures_babel/ignore.js
vendored
Normal file
1
external/builder/fixtures_babel/ignore.js
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
const wasmUrl = new URL("qwerty.wasm" , import.meta.url);
|
||||||
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"stableVersion": "5.1.91",
|
"stableVersion": "5.1.91",
|
||||||
"baseVersion": "d86045eacbd6f8cc9cbe8fd616800ca3edcbd0dc",
|
"baseVersion": "e5fbf52405fbb092351ef1cda8f44fbae3a84473",
|
||||||
"versionPrefix": "5.1."
|
"versionPrefix": "5.2."
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user