File tree Expand file tree Collapse file tree 5 files changed +57
-1
lines changed
tests/specs/bundle/require_browser Expand file tree Collapse file tree 5 files changed +57
-1
lines changed Original file line number Diff line number Diff line change @@ -173,7 +173,9 @@ impl BundleProvider for CliBundleProvider {
173173 super :: process_result (
174174 & result,
175175 & bundler. cwd ,
176- true ,
176+ crate :: tools:: bundle:: should_replace_require_shim (
177+ bundle_flags. platform ,
178+ ) ,
177179 bundle_flags. minify ,
178180 bundler. input ,
179181 bundle_flags. output_dir . as_ref ( ) . map ( Path :: new) ,
Original file line number Diff line number Diff line change 1+ {
2+ "tempDir" : true ,
3+ "tests" : {
4+ "api" : {
5+ "steps" : [
6+ {
7+ "args" : " run --unstable-bundle bundle.ts" ,
8+ "output" : " [WILDCARD]"
9+ },
10+ {
11+ "args" : " run -A has-createrequire.ts bundle.js" ,
12+ "output" : " false\n "
13+ }
14+ ]
15+ },
16+ "cli" : {
17+ "steps" : [
18+ {
19+ "args" : " bundle --platform browser --output bundle.js foo.cjs" ,
20+ "output" : " [WILDCARD]"
21+ },
22+ {
23+ "args" : " run -A has-createrequire.ts bundle.js" ,
24+ "output" : " false\n "
25+ }
26+ ]
27+ }
28+ }
29+ }
Original file line number Diff line number Diff line change 1+ await Deno . bundle ( {
2+ entrypoints : [ "./foo.cjs" ] ,
3+ platform : "browser" ,
4+ outputPath : "bundle.js" ,
5+ } ) ;
Original file line number Diff line number Diff line change 1+ let arch ;
2+ if ( typeof globalThis . window !== "undefined" ) {
3+ const os = require ( "node:os" ) ;
4+ arch = os . arch ;
5+ } else {
6+ arch = "browser" ;
7+ }
8+ module . exports = {
9+ hi : "hi" ,
10+ arch,
11+ } ;
Original file line number Diff line number Diff line change 1+ const file = Deno . args [ 0 ] ;
2+
3+ const contents = Deno . readTextFileSync ( file ) ;
4+
5+ if ( contents . includes ( "createRequire" ) ) {
6+ console . log ( "true" ) ;
7+ } else {
8+ console . log ( "false" ) ;
9+ }
You can’t perform that action at this time.
0 commit comments