@@ -103,7 +103,8 @@ export async function build(
103
103
return importUrl === alephPkgUri + "/server/mod.ts" ||
104
104
// since deno deploy doesn't support importMap, we need to resolve the 'react' import
105
105
importUrl . startsWith ( alephPkgUri + "/framework/react/" ) ||
106
- importUrl . startsWith ( `http://localhost:${ Deno . env . get ( "ALEPH_APP_MODULES_PORT" ) } /` ) ;
106
+ importUrl . startsWith ( `http://localhost:${ Deno . env . get ( "ALEPH_APP_MODULES_PORT" ) } /` ) ||
107
+ importUrl . endsWith ( ".css" ) ;
107
108
} ;
108
109
109
110
// build server entry
@@ -135,6 +136,10 @@ export async function build(
135
136
const isRemote = util . isLikelyHttpURL ( importUrl ) ;
136
137
const [ path ] = util . splitBy ( isRemote ? importUrl : util . trimPrefix ( importUrl , "file://" ) , "#" ) ;
137
138
139
+ if ( args . kind === "dynamic-import" ) {
140
+ return { path, external : true } ;
141
+ }
142
+
138
143
if ( args . namespace === "http" ) {
139
144
const { href } = new URL ( path , args . importer ) ;
140
145
if ( ! forceBundle ( href ) ) {
@@ -160,26 +165,30 @@ export async function build(
160
165
}
161
166
const res = await cache ( url . href ) ;
162
167
const contents = await res . text ( ) ;
163
- let ext = extname ( url . pathname ) . slice ( 1 ) ;
168
+ const ext = extname ( url . pathname ) . slice ( 1 ) ;
169
+ let loader = ext ;
164
170
if ( ext === "mjs" ) {
165
- ext = "js" ;
171
+ loader = "js" ;
166
172
} else if ( ext === "mts" ) {
167
- ext = "ts" ;
168
- } else if ( ! builtinModuleExts . includes ( ext ) ) {
169
- const ctype = res . headers . get ( "Content-Type" ) ;
170
- if ( ctype ?. startsWith ( "application/javascript" ) ) {
171
- ext = "js" ;
172
- } else if ( ctype ?. startsWith ( "application/typescript" ) ) {
173
- ext = "ts" ;
174
- } else if ( ctype ?. startsWith ( "text/jsx" ) ) {
175
- ext = "jsx" ;
176
- } else if ( ctype ?. startsWith ( "text/tsx" ) ) {
177
- ext = "tsx" ;
178
- }
173
+ loader = "ts" ;
174
+ } else if ( ext === "pcss" || ext === "postcss" ) {
175
+ loader = "css" ;
176
+ }
177
+ const ctype = res . headers . get ( "Content-Type" ) ;
178
+ if ( ctype ?. startsWith ( "application/javascript" ) ) {
179
+ loader = "js" ;
180
+ } else if ( ctype ?. startsWith ( "application/typescript" ) ) {
181
+ loader = "ts" ;
182
+ } else if ( ctype ?. startsWith ( "text/jsx" ) ) {
183
+ loader = "jsx" ;
184
+ } else if ( ctype ?. startsWith ( "text/tsx" ) ) {
185
+ loader = "tsx" ;
186
+ } else if ( ctype ?. startsWith ( "text/css" ) ) {
187
+ loader = "css" ;
179
188
}
180
189
return {
181
190
contents,
182
- loader : ext as unknown as Loader ,
191
+ loader : loader as unknown as Loader ,
183
192
} ;
184
193
} ) ;
185
194
} ,
0 commit comments