Skip to content

Commit 530b9dd

Browse files
stepankuzmingithub-actions[bot]
authored andcommitted
Ban import.meta.url in UMD bundle
GitOrigin-RevId: 18ad66f9de6892fe7defbe1d6f5cafa24ef3535c
1 parent e9f32dc commit 530b9dd

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

eslint.config.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,9 @@ export default tseslint.config(
120120
}, {
121121
selector: 'ChainExpression',
122122
message: 'Optional chaining is now allowed.',
123+
}, {
124+
selector: 'MemberExpression[object.type=\'MetaProperty\'][property.name=\'url\']',
125+
message: 'import.meta.url is not available in the UMD bundle.',
123126
}
124127
],
125128
}
@@ -289,7 +292,9 @@ export default tseslint.config(
289292
files: [
290293
'test/**',
291294
'build/**',
292-
'rollup.*'
295+
'rollup.*',
296+
'src/style-spec/test.js',
297+
'src/style-spec/rollup.config.js',
293298
],
294299

295300
rules: {

src/util/web_worker_esm.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import WorkerClass from './worker_class';
33
export function createWorker(): Worker {
44
const workerUrl = WorkerClass.workerUrl ?
55
WorkerClass.workerUrl :
6+
// it's safe to use import.meta.url here because this file is only used in the ESM bundle
7+
// eslint-disable-next-line no-restricted-syntax
68
new URL('worker.js', import.meta.url).href;
79

810
const blob = new Blob([`import '${workerUrl}';`], {type: 'application/javascript'});

0 commit comments

Comments
 (0)