Skip to content

Commit

Permalink
feat: add wasm file to file exports (#755)
Browse files Browse the repository at this point in the history
  • Loading branch information
elevatebart authored Aug 6, 2024
1 parent dcbb997 commit 27b7274
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions scripts/build-wasm.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,23 @@ wasmPkg.type = 'module';
wasmPkg.main = 'index.mjs';
wasmPkg.module = 'index.mjs';
wasmPkg.exports = {
types: './index.d.ts',
node: {
import: './wasm-node.mjs',
require: './wasm-node.cjs',
'.': {
types: './index.d.ts',
node: {
import: './wasm-node.mjs',
require: './wasm-node.cjs'
},
default: {
import: './index.mjs',
require: './index.cjs'
}
},
default: {
import: './index.mjs',
require: './index.cjs',
// Allow esbuild to import the wasm file
// without copying it in the src directory.
// Simplifies loading it in the browser when used in a library.
'./lightningcss_node.wasm': {
import: './lightningcss_node.wasm',
require: './lightningcss_node.wasm'
}
};
wasmPkg.types = 'index.d.ts';
Expand Down

0 comments on commit 27b7274

Please sign in to comment.