Skip to content

Commit

Permalink
Default to ESM imports, use CJS imports in CJS builds
Browse files Browse the repository at this point in the history
Closes #392
  • Loading branch information
wojtekmaj committed Jul 31, 2023
1 parent c25d271 commit df171fd
Show file tree
Hide file tree
Showing 3 changed files with 203 additions and 15 deletions.
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,11 @@
},
"scripts": {
"build": "yarn build-js && yarn copy-styles",
"build-js": "yarn build-js-esm && yarn build-js-cjs && yarn build-js-cjs-package",
"build-js": "yarn build-js-esm && yarn build-js-cjs && yarn build-js-cjs-package && yarn build-js-cjs-replace",
"build-js-esm": "tsc --project tsconfig.build.json --outDir dist/esm --module esnext",
"build-js-cjs": "tsc --project tsconfig.build.json --outDir dist/cjs --module commonjs",
"build-js-cjs-package": "echo '{\n \"type\": \"commonjs\"\n}' > dist/cjs/package.json",
"build-js-cjs-replace": "yarn replace-in-files --string='/dist/esm/' --replacement='/dist/cjs/' dist/cjs/**/*",
"clean": "rimraf dist",
"copy-styles": "cpy 'src/**/*.css' dist",
"lint": "eslint . --ext .js,.jsx,.ts,.tsx",
Expand Down Expand Up @@ -90,6 +91,7 @@
"pretty-quick": "^3.1.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"replace-in-files-cli": "^2.2.0",
"rimraf": "^3.0.0",
"typescript": "^5.0.0",
"vitest": "^0.30.1",
Expand Down
18 changes: 9 additions & 9 deletions src/DateTimeInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ import {
} from '@wojtekmaj/date-utils';

import Divider from './Divider.js';
import DayInput from 'react-date-picker/dist/cjs/DateInput/DayInput';
import MonthInput from 'react-date-picker/dist/cjs/DateInput/MonthInput';
import MonthSelect from 'react-date-picker/dist/cjs/DateInput/MonthSelect';
import YearInput from 'react-date-picker/dist/cjs/DateInput/YearInput';
import Hour12Input from 'react-time-picker/dist/cjs/TimeInput/Hour12Input';
import Hour24Input from 'react-time-picker/dist/cjs/TimeInput/Hour24Input';
import MinuteInput from 'react-time-picker/dist/cjs/TimeInput/MinuteInput';
import SecondInput from 'react-time-picker/dist/cjs/TimeInput/SecondInput';
import AmPm from 'react-time-picker/dist/cjs/TimeInput/AmPm';
import DayInput from 'react-date-picker/dist/esm/DateInput/DayInput';
import MonthInput from 'react-date-picker/dist/esm/DateInput/MonthInput';
import MonthSelect from 'react-date-picker/dist/esm/DateInput/MonthSelect';
import YearInput from 'react-date-picker/dist/esm/DateInput/YearInput';
import Hour12Input from 'react-time-picker/dist/esm/TimeInput/Hour12Input';
import Hour24Input from 'react-time-picker/dist/esm/TimeInput/Hour24Input';
import MinuteInput from 'react-time-picker/dist/esm/TimeInput/MinuteInput';
import SecondInput from 'react-time-picker/dist/esm/TimeInput/SecondInput';
import AmPm from 'react-time-picker/dist/esm/TimeInput/AmPm';
import NativeInput from './DateTimeInput/NativeInput.js';

import { getFormatter, getNumberFormatter, formatDate } from './shared/dateFormatter.js';
Expand Down
Loading

0 comments on commit df171fd

Please sign in to comment.