Skip to content

tmpfs-archive/swc-builtin-shim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Spack Builtin Shim

An attempt to use shims for node builtin modules.

yarn install
npx spack

When compiling with spack for the browser and using builtin modules such as assert and events we encountered this error when executing the generated bundle:

Uncaught SyntaxError: Cannot use import statement outside a module

It appears that builtin modules are passed through as import statements untouched as there is no available code to compile.

However, when we added the assert and events packages to be used as shims and updated .swcrc to configure the paths:

{
  "jsc": {
    "paths": {
      "assert": ["node_modules/assert"],
      "events": ["node_modules/events"]
    }
  }
}

These shims for the builtin modules are not used and the compiled bundle still includes the original import statements.

About

MVP for an attempt to shim built in modules using spack

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors