Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Vite to build the library bundle included in the NPM package #27

Merged
merged 1 commit into from
Feb 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
127 changes: 0 additions & 127 deletions build/generate-dist.js

This file was deleted.

2 changes: 1 addition & 1 deletion jest.config.js → jest.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module.exports = {
testEnvironment: 'jsdom',
transform: {
'^.+\\.(ts|xml)$': [
'<rootDir>/jest.ts-transformer.js',
'<rootDir>/jest.ts-transformer.cjs',
{
isolatedModules: true,
stringifyContentPathRegex: '.(xml)$',
Expand Down
12 changes: 7 additions & 5 deletions jest.ts-transformer.js → jest.ts-transformer.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ const tsJest = require('ts-jest').default;

module.exports = {
// this transformer applies ts-jest but also makes sure
// that Worker constructors get the full path
// that the Worker constructor get the full path
process(src, filename, options) {
const dir = path.dirname(filename);
const transformed = src.replace(
/new Worker\(new URL\(['"](.+)['"], import\.meta\.url\)/,
`new Worker('${dir}/$1'`
);
const transformed = src
.replace(
/new OgcClientWorker\(\)/,
`new Worker('${dir}/worker.ts', { type: 'module' })`
)
.replace(`import OgcClientWorker from './worker?worker&inline';`, '');
return tsJest
.createTransformer(options.transformerConfig)
.process(transformed, filename, options);
Expand Down
Loading
Loading