File tree 1 file changed +13
-1
lines changed
1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -33,11 +33,23 @@ import initialCssPlugin from './lib/initial-css-plugin';
33
33
import serviceWorkerPlugin from './lib/sw-plugin' ;
34
34
import dataURLPlugin from './lib/data-url-plugin' ;
35
35
import entryDataPlugin , { fileNameToURL } from './lib/entry-data-plugin' ;
36
+ import dedent from 'dedent' ;
36
37
37
38
function resolveFileUrl ( { fileName } ) {
38
39
return JSON . stringify ( fileNameToURL ( fileName ) ) ;
39
40
}
40
41
42
+ function resolveImportMetaUrlInStaticBuild ( property , { moduleId } ) {
43
+ if ( property !== 'url' ) return ;
44
+ throw new Error ( dedent `
45
+ Attempted to use a \`new URL(..., import.meta.url)\` pattern in ${ path . relative (
46
+ process . cwd ( ) ,
47
+ moduleId ,
48
+ ) } for URL that needs to end up in static HTML.
49
+ This is currently unsupported.
50
+ ` ) ;
51
+ }
52
+
41
53
const dir = '.tmp/build' ;
42
54
const staticPath = 'static/c/[name]-[hash][extname]' ;
43
55
const jsPath = staticPath . replace ( '[extname]' , '.js' ) ;
@@ -100,7 +112,7 @@ export default async function ({ watch }) {
100
112
} ,
101
113
preserveModules : true ,
102
114
plugins : [
103
- { resolveFileUrl } ,
115
+ { resolveFileUrl, resolveImportMeta : resolveImportMetaUrlInStaticBuild } ,
104
116
clientBundlePlugin (
105
117
{
106
118
external : [ 'worker_threads' ] ,
You can’t perform that action at this time.
0 commit comments