diff --git a/.babelrc.js b/.babelrc.js new file mode 100644 index 00000000..69a629c5 --- /dev/null +++ b/.babelrc.js @@ -0,0 +1,15 @@ +module.exports = { + presets: [ + "@babel/preset-react", + "@babel/preset-typescript", + [ + "@babel/preset-env", + { + targets: { + browsers: [">0.25%", "not dead"], + }, + }, + ], + ], + plugins: [["transform-react-remove-prop-types", { removeImport: true }]], +}; diff --git a/babel.config.json b/babel.config.json deleted file mode 100644 index 947229d9..00000000 --- a/babel.config.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "presets": [ - "@babel/preset-react", - "@babel/preset-typescript", - [ - "@babel/preset-env", - { - "targets": { - "browsers": [">0.25%", "not dead"] - } - } - ] - ], - "plugins": [["transform-react-remove-prop-types", { "removeImport": true }]] -} diff --git a/package.json b/package.json index e00cf7bd..2292a142 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,6 @@ "author": "freeCodeCamp ", "license": "BSD-3-Clause", "description": "The freeCodeCamp.org open-source UI components", - "type": "module", "main": "dist/bundle.js", "module": "dist/bundle.es.js", "style": "dist/base.css", @@ -42,7 +41,7 @@ "storybook": "storybook dev -p 6006 --no-open", "storybook:theming": "pnpm run storybook --no-manager-cache", "clean": "rm -rf dist/*", - "gen-component": "tsx ./utils/gen-component-script", + "gen-component": "ts-node ./utils/gen-component-script", "test": "jest", "prepare": "husky", "typecheck": "tsc" diff --git a/tsconfig.json b/tsconfig.json index 066b4727..8e9e870b 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,20 +1,19 @@ { "compilerOptions": { - "module": "ES2022", + "module": "ES6", "target": "ES6", "sourceMap": true, "jsx": "react", "allowSyntheticDefaultImports": true, "esModuleInterop": true, - "moduleResolution": "Bundler", + "moduleResolution": "node", "strict": true, "noEmit": true, "skipLibCheck": true }, "ts-node": { "compilerOptions": { - "module": "commonjs", - "moduleResolution": "Node10" // Unfortunately we're stuck with this until Jest stops using ts-node + "module": "commonjs" }, "transpileOnly": true } diff --git a/utils/gen-component-script.ts b/utils/gen-component-script.ts index a7f793b8..b357bb75 100644 --- a/utils/gen-component-script.ts +++ b/utils/gen-component-script.ts @@ -24,7 +24,7 @@ const toKebabCase = (pascalCasedName: string) => const kebabCasedName = toKebabCase(name); -const dir = path.join(import.meta.dirname, `../src/${kebabCasedName}`); +const dir = path.join(__dirname, `../src/${kebabCasedName}`); // Throw an error if the component's folder already exists if (fs.existsSync(dir)) {