Skip to content

fix: export interval based and timer based on index#295

Closed
ntsd wants to merge 1 commit intoP4sca1:mainfrom
ntsd:main
Closed

fix: export interval based and timer based on index#295
ntsd wants to merge 1 commit intoP4sca1:mainfrom
ntsd:main

Conversation

@ntsd
Copy link
Copy Markdown

@ntsd ntsd commented May 9, 2023

  • export interval-based and timer-based on index.js (main file)

ref: https://docs.npmjs.com/cli/v9/configuring-npm/package-json#main

- export interval based and timer based on index
@P4sca1
Copy link
Copy Markdown
Owner

P4sca1 commented May 26, 2023

Hey @ntsd, thank you for your contribution.
The schedulers intentionally got removed from the main file to keep the bundle size low, which is especially important when using this library in the browser and only parsing cron expressions.
Could you share your setup and the issues you are facing with importing the schedulers individually?

@ntsd
Copy link
Copy Markdown
Author

ntsd commented May 28, 2023

@P4sca1 Thank you for the response, It's happened in VIte Svetekit the error is

[plugin:vite:import-analysis] Missing "./schedulers/interval-based" specifier in "cron-schedule" package

I tried to import

cron-schedule/schedulers/timer-based.js

and

cron-schedule/dist/schedulers/timer-based.js

both ways doesn't work

vite.config.js

import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig } from 'vite';

export default defineConfig({
	plugins: [sveltekit()],
	css: { postcss: './config/postcss.config.cjs' }
});

svelte.config.js

import adapter from '@sveltejs/adapter-static';
import { vitePreprocess } from '@sveltejs/kit/vite';

const config = {
	preprocess: vitePreprocess(),

	kit: {
		adapter: adapter(),
		paths: {},
		prerender: {}
	}
};

export default config;

tsconfig.json

{
	"extends": "./.svelte-kit/tsconfig.json",
	"compilerOptions": {
		"allowJs": true,
		"checkJs": true,
		"esModuleInterop": true,
		"forceConsistentCasingInFileNames": true,
		"resolveJsonModule": true,
		"skipLibCheck": true,
		"sourceMap": true,
		"strict": true
	}
	// Path aliases are handled by https://kit.svelte.dev/docs/configuration#alias
	//
	// If you want to overwrite includes/excludes, make sure to copy over the relevant includes/excludes
	// from the referenced tsconfig.json - TypeScript does not merge them in
}

It was for this project https://github.com/ntsd/auto-evm-wallet I published the new version that works.

@P4sca1
Copy link
Copy Markdown
Owner

P4sca1 commented May 31, 2023

If you’re using Node 12 or 14, you should use --moduleResolution node16. The features added to 16 have fully or mostly been backported to 12 and 14.
--moduleResolution node is for Node 11 and older. Its name is currently bad. We plan to rename it accordingly.

microsoft/TypeScript#50794

The package exports work as expected with the correct module resolution. The minimum required node version is node 16 to use this package. If you need to use another version, please see version 3 of this package.

@P4sca1 P4sca1 closed this May 31, 2023
@ntsd
Copy link
Copy Markdown
Author

ntsd commented May 31, 2023

If you’re using Node 12 or 14, you should use --moduleResolution node16. The features added to 16 have fully or mostly been backported to 12 and 14.
--moduleResolution node is for Node 11 and older. Its name is currently bad. We plan to rename it accordingly.

microsoft/TypeScript#50794

The package exports work as expected with the correct module resolution. The minimum required node version is node 16 to use this package. If you need to use another version, please see version 3 of this package.

Got it, Thank you for explaining.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants