Skip to content

Commit

Permalink
Merge pull request #52 from camptocamp/add-node-dist
Browse files Browse the repository at this point in the history
Add node-specific bundle in the package
  • Loading branch information
jahow authored Jun 17, 2024
2 parents 5d5663c + 9290d24 commit 02b9b14
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 5 deletions.
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,10 @@
"format:check": "prettier --check .",
"lint": "eslint src/**/*.ts",
"lint:fix": "npm run lint -- --fix",
"build": "vite build && esbuild $(find ./src -name \"*.ts\" -type f -not -path '*worker/index.ts' -not -path '*.spec.ts') --outdir=./dist --platform=neutral --format=esm --sourcemap",
"build": "npm run build:worker && npm run build:node && npm run build:browser",
"build:browser": "esbuild $(find ./src -name \"*.ts\" -type f -not -path '*worker/index.ts' -not -path '*.spec.ts') --outdir=./dist --platform=neutral --format=esm --sourcemap",
"build:node": "vite build --config vite.node-config.js",
"build:worker": "vite build --config vite.worker-config.js",
"prepublishOnly": "npm run typecheck && npm test && npm run build",
"typecheck": "tsc --noEmit"
},
Expand Down
8 changes: 4 additions & 4 deletions src-node/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @ts-nocheck
import './polyfills';
import { enableFallbackWithoutWorker } from '../src';
export * from '../src/index';
import './polyfills.js';
import { enableFallbackWithoutWorker } from '../src/index.js';

export * from '../src/index.js';

enableFallbackWithoutWorker();
1 change: 1 addition & 0 deletions src-node/polyfills.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-nocheck
import 'regenerator-runtime/runtime';
import { EventEmitter } from 'events';
Expand Down
22 changes: 22 additions & 0 deletions vite.node-config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { defineConfig } from 'vite';
import { dependencies, devDependencies } from './package.json';

export default defineConfig({
build: {
ssr: true,
rollupOptions: {
external: [/^ol/, 'proj4'],
input: 'src-node/index.ts',
output: {
entryFileNames: 'dist-node.js',
globals: (name) => name,
},
},
outDir: 'dist',
minify: false,
},
ssr: {
noExternal: Object.keys(dependencies).concat(Object.keys(devDependencies)),
target: 'node',
},
});
File renamed without changes.

0 comments on commit 02b9b14

Please sign in to comment.