@nx/react 0.0.0-pr-22179-271588f
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +22 -0
- package/README.md +68 -0
- package/ast-utils.d.ts +1 -0
- package/ast-utils.js +11 -0
- package/babel.d.ts +20 -0
- package/babel.js +50 -0
- package/executors.json +14 -0
- package/generators.json +112 -0
- package/index.d.ts +22 -0
- package/index.js +47 -0
- package/mf/dynamic-federation.d.ts +4 -0
- package/mf/dynamic-federation.js +75 -0
- package/mf/index.d.ts +1 -0
- package/mf/index.js +7 -0
- package/migrations.json +310 -0
- package/module-federation.d.ts +4 -0
- package/module-federation.js +12 -0
- package/package.json +49 -0
- package/plugins/bundle-rollup.d.ts +1 -0
- package/plugins/bundle-rollup.js +47 -0
- package/plugins/component-testing/index.d.ts +37 -0
- package/plugins/component-testing/index.js +222 -0
- package/plugins/component-testing/webpack-fallback.d.ts +5 -0
- package/plugins/component-testing/webpack-fallback.js +125 -0
- package/plugins/jest.d.ts +1 -0
- package/plugins/jest.js +59 -0
- package/plugins/nx-react-webpack-plugin/lib/apply-react-config.d.ts +4 -0
- package/plugins/nx-react-webpack-plugin/lib/apply-react-config.js +60 -0
- package/plugins/nx-react-webpack-plugin/nx-react-webpack-plugin.d.ts +8 -0
- package/plugins/nx-react-webpack-plugin/nx-react-webpack-plugin.js +13 -0
- package/plugins/storybook/index.d.ts +3 -0
- package/plugins/storybook/index.js +174 -0
- package/plugins/storybook/merge-plugins.d.ts +3 -0
- package/plugins/storybook/merge-plugins.js +17 -0
- package/plugins/webpack.d.ts +1 -0
- package/plugins/webpack.js +6 -0
- package/plugins/with-react.d.ts +10 -0
- package/plugins/with-react.js +22 -0
- package/src/executors/module-federation-dev-server/module-federation-dev-server.impl.d.ts +25 -0
- package/src/executors/module-federation-dev-server/module-federation-dev-server.impl.js +211 -0
- package/src/executors/module-federation-dev-server/schema.json +114 -0
- package/src/executors/module-federation-ssr-dev-server/module-federation-ssr-dev-server.impl.d.ts +9 -0
- package/src/executors/module-federation-ssr-dev-server/module-federation-ssr-dev-server.impl.js +106 -0
- package/src/executors/module-federation-ssr-dev-server/schema.json +48 -0
- package/src/generators/application/application.d.ts +5 -0
- package/src/generators/application/application.js +232 -0
- package/src/generators/application/files/base-rspack/src/app/__fileName__.spec.tsx__tmpl__ +10 -0
- package/src/generators/application/files/base-rspack/src/assets/.gitkeep +0 -0
- package/src/generators/application/files/base-rspack/src/favicon.ico +0 -0
- package/src/generators/application/files/base-rspack/src/index.html +14 -0
- package/src/generators/application/files/base-rspack/src/main.tsx__tmpl__ +10 -0
- package/src/generators/application/files/base-rspack/tsconfig.app.json__tmpl__ +14 -0
- package/src/generators/application/files/base-vite/index.html__tmpl__ +16 -0
- package/src/generators/application/files/base-vite/public/favicon.ico +0 -0
- package/src/generators/application/files/base-vite/src/app/__fileName__.spec.tsx__tmpl__ +10 -0
- package/src/generators/application/files/base-vite/src/assets/.gitkeep +0 -0
- package/src/generators/application/files/base-vite/src/environments/environment.prod.ts__tmpl__ +3 -0
- package/src/generators/application/files/base-vite/src/environments/environment.ts__tmpl__ +6 -0
- package/src/generators/application/files/base-vite/src/main.tsx__tmpl__ +10 -0
- package/src/generators/application/files/base-vite/tsconfig.app.json__tmpl__ +14 -0
- package/src/generators/application/files/base-webpack/src/app/__fileName__.spec.tsx__tmpl__ +10 -0
- package/src/generators/application/files/base-webpack/src/assets/.gitkeep +0 -0
- package/src/generators/application/files/base-webpack/src/favicon.ico +0 -0
- package/src/generators/application/files/base-webpack/src/index.html +12 -0
- package/src/generators/application/files/base-webpack/src/main.tsx__tmpl__ +10 -0
- package/src/generators/application/files/base-webpack/tsconfig.app.json__tmpl__ +14 -0
- package/src/generators/application/files/base-webpack/webpack.config.js__tmpl__ +50 -0
- package/src/generators/application/files/nx-welcome/src/app/nx-welcome.tsx +886 -0
- package/src/generators/application/files/style-css-module/src/app/__fileName__.module.__style__ +1 -0
- package/src/generators/application/files/style-css-module/src/app/__fileName__.tsx__tmpl__ +36 -0
- package/src/generators/application/files/style-css-module/src/styles.__style__ +1 -0
- package/src/generators/application/files/style-global-css/src/app/__fileName__.__style__ +1 -0
- package/src/generators/application/files/style-global-css/src/app/__fileName__.tsx__tmpl__ +35 -0
- package/src/generators/application/files/style-global-css/src/styles.__style__ +1 -0
- package/src/generators/application/files/style-none/src/app/__fileName__.tsx__tmpl__ +34 -0
- package/src/generators/application/files/style-styled-jsx/src/app/__fileName__.tsx__tmpl__ +37 -0
- package/src/generators/application/files/style-styled-module/src/app/__fileName__.tsx__tmpl__ +40 -0
- package/src/generators/application/files/style-tailwind/src/app/__fileName__.tsx__tmpl__ +33 -0
- package/src/generators/application/files/style-tailwind/src/styles.css +1 -0
- package/src/generators/application/lib/add-e2e.d.ts +3 -0
- package/src/generators/application/lib/add-e2e.js +79 -0
- package/src/generators/application/lib/add-jest.d.ts +3 -0
- package/src/generators/application/lib/add-jest.js +21 -0
- package/src/generators/application/lib/add-project.d.ts +3 -0
- package/src/generators/application/lib/add-project.js +96 -0
- package/src/generators/application/lib/add-routing.d.ts +3 -0
- package/src/generators/application/lib/add-routing.js +27 -0
- package/src/generators/application/lib/create-application-files.d.ts +3 -0
- package/src/generators/application/lib/create-application-files.js +143 -0
- package/src/generators/application/lib/find-free-port.d.ts +2 -0
- package/src/generators/application/lib/find-free-port.js +16 -0
- package/src/generators/application/lib/get-app-tests.d.ts +2 -0
- package/src/generators/application/lib/get-app-tests.js +21 -0
- package/src/generators/application/lib/install-common-dependencies.d.ts +3 -0
- package/src/generators/application/lib/install-common-dependencies.js +47 -0
- package/src/generators/application/lib/normalize-options.d.ts +5 -0
- package/src/generators/application/lib/normalize-options.js +72 -0
- package/src/generators/application/lib/set-defaults.d.ts +3 -0
- package/src/generators/application/lib/set-defaults.js +43 -0
- package/src/generators/application/lib/show-possible-warnings.d.ts +3 -0
- package/src/generators/application/lib/show-possible-warnings.js +11 -0
- package/src/generators/application/lib/update-jest-config.d.ts +3 -0
- package/src/generators/application/lib/update-jest-config.js +30 -0
- package/src/generators/application/schema.d.ts +45 -0
- package/src/generators/application/schema.json +201 -0
- package/src/generators/component/component.d.ts +5 -0
- package/src/generators/component/component.js +93 -0
- package/src/generators/component/files/__fileName__.__style__ +0 -0
- package/src/generators/component/files/__fileName__.module.__style__ +7 -0
- package/src/generators/component/files/__fileName__.spec.tsx__tmpl__ +7 -0
- package/src/generators/component/files/__fileName__.tsx__tmpl__ +88 -0
- package/src/generators/component/lib/get-component-tests.d.ts +2 -0
- package/src/generators/component/lib/get-component-tests.js +12 -0
- package/src/generators/component/lib/normalize-options.d.ts +3 -0
- package/src/generators/component/lib/normalize-options.js +50 -0
- package/src/generators/component/schema.d.ts +48 -0
- package/src/generators/component/schema.json +150 -0
- package/src/generators/component-cypress-spec/component-cypress-spec.d.ts +13 -0
- package/src/generators/component-cypress-spec/component-cypress-spec.js +100 -0
- package/src/generators/component-cypress-spec/files/__componentName__.__fileExt__ +13 -0
- package/src/generators/component-cypress-spec/schema.json +44 -0
- package/src/generators/component-story/component-story.d.ts +12 -0
- package/src/generators/component-story/component-story.js +72 -0
- package/src/generators/component-story/files/jsx/__componentFileName__.stories.jsx__tmpl__ +29 -0
- package/src/generators/component-story/files/tsx/__componentFileName__.stories.tsx__tmpl__ +36 -0
- package/src/generators/component-story/schema.json +42 -0
- package/src/generators/component-test/component-test.d.ts +4 -0
- package/src/generators/component-test/component-test.js +76 -0
- package/src/generators/component-test/files/__fileName__.cy__ext__ +21 -0
- package/src/generators/component-test/schema.d.ts +4 -0
- package/src/generators/component-test/schema.js +2 -0
- package/src/generators/component-test/schema.json +31 -0
- package/src/generators/cypress-component-configuration/cypress-component-configuration.d.ts +10 -0
- package/src/generators/cypress-component-configuration/cypress-component-configuration.js +51 -0
- package/src/generators/cypress-component-configuration/lib/add-files.d.ts +4 -0
- package/src/generators/cypress-component-configuration/lib/add-files.js +45 -0
- package/src/generators/cypress-component-configuration/schema.d.ts +8 -0
- package/src/generators/cypress-component-configuration/schema.json +54 -0
- package/src/generators/federate-module/federate-module.d.ts +4 -0
- package/src/generators/federate-module/federate-module.js +70 -0
- package/src/generators/federate-module/lib/utils.d.ts +23 -0
- package/src/generators/federate-module/lib/utils.js +100 -0
- package/src/generators/federate-module/schema.d.ts +13 -0
- package/src/generators/federate-module/schema.json +83 -0
- package/src/generators/hook/files/__fileName__.spec.tsx__tmpl__ +18 -0
- package/src/generators/hook/files/__fileName__.ts__tmpl__ +15 -0
- package/src/generators/hook/hook.d.ts +5 -0
- package/src/generators/hook/hook.js +131 -0
- package/src/generators/hook/schema.d.ts +24 -0
- package/src/generators/hook/schema.json +84 -0
- package/src/generators/host/files/common/src/app/__fileName__.js__tmpl__ +33 -0
- package/src/generators/host/files/common/src/main.js__tmpl__ +10 -0
- package/src/generators/host/files/common/tsconfig.lint.json__tmpl__ +19 -0
- package/src/generators/host/files/common-ts/src/app/__fileName__.tsx__tmpl__ +41 -0
- package/src/generators/host/files/common-ts/src/main.ts__tmpl__ +10 -0
- package/src/generators/host/files/module-federation/module-federation.config.js__tmpl__ +21 -0
- package/src/generators/host/files/module-federation/webpack.config.js__tmpl__ +12 -0
- package/src/generators/host/files/module-federation/webpack.config.prod.js__tmpl__ +32 -0
- package/src/generators/host/files/module-federation-ssr/module-federation.server.config.js__tmpl__ +16 -0
- package/src/generators/host/files/module-federation-ssr/server.ts__tmpl__ +28 -0
- package/src/generators/host/files/module-federation-ssr/tsconfig.server.json__tmpl__ +17 -0
- package/src/generators/host/files/module-federation-ssr/webpack.server.config.js__tmpl__ +12 -0
- package/src/generators/host/files/module-federation-ssr-ts/module-federation.server.config.ts__tmpl__ +13 -0
- package/src/generators/host/files/module-federation-ssr-ts/server.ts__tmpl__ +28 -0
- package/src/generators/host/files/module-federation-ssr-ts/tsconfig.server.json__tmpl__ +17 -0
- package/src/generators/host/files/module-federation-ssr-ts/webpack.server.config.ts__tmpl__ +12 -0
- package/src/generators/host/files/module-federation-ts/module-federation.config.ts__tmpl__ +25 -0
- package/src/generators/host/files/module-federation-ts/webpack.config.prod.ts__tmpl__ +33 -0
- package/src/generators/host/files/module-federation-ts/webpack.config.ts__tmpl__ +12 -0
- package/src/generators/host/host.d.ts +5 -0
- package/src/generators/host/host.js +95 -0
- package/src/generators/host/lib/add-module-federation-files.d.ts +6 -0
- package/src/generators/host/lib/add-module-federation-files.js +52 -0
- package/src/generators/host/lib/normalize-remote.d.ts +4 -0
- package/src/generators/host/lib/normalize-remote.js +28 -0
- package/src/generators/host/lib/setup-ssr-for-host.d.ts +6 -0
- package/src/generators/host/lib/setup-ssr-for-host.js +33 -0
- package/src/generators/host/lib/update-module-federation-e2e-project.d.ts +3 -0
- package/src/generators/host/lib/update-module-federation-e2e-project.js +20 -0
- package/src/generators/host/schema.d.ts +37 -0
- package/src/generators/host/schema.json +184 -0
- package/src/generators/init/init.d.ts +4 -0
- package/src/generators/init/init.js +23 -0
- package/src/generators/init/schema.d.ts +5 -0
- package/src/generators/init/schema.json +27 -0
- package/src/generators/library/files/common/README.md +7 -0
- package/src/generators/library/files/common/package.json__tmpl__ +4 -0
- package/src/generators/library/files/common/src/index.ts__tmpl__ +0 -0
- package/src/generators/library/files/common/tsconfig.lib.json__tmpl__ +14 -0
- package/src/generators/library/files/vite/README.md +7 -0
- package/src/generators/library/files/vite/package.json__tmpl__ +12 -0
- package/src/generators/library/files/vite/tsconfig.lib.json__tmpl__ +14 -0
- package/src/generators/library/lib/add-linting.d.ts +3 -0
- package/src/generators/library/lib/add-linting.js +36 -0
- package/src/generators/library/lib/add-rollup-build-target.d.ts +4 -0
- package/src/generators/library/lib/add-rollup-build-target.js +59 -0
- package/src/generators/library/lib/create-files.d.ts +3 -0
- package/src/generators/library/lib/create-files.js +53 -0
- package/src/generators/library/lib/install-common-dependencies.d.ts +3 -0
- package/src/generators/library/lib/install-common-dependencies.js +47 -0
- package/src/generators/library/lib/normalize-options.d.ts +3 -0
- package/src/generators/library/lib/normalize-options.js +92 -0
- package/src/generators/library/lib/set-defaults.d.ts +3 -0
- package/src/generators/library/lib/set-defaults.js +23 -0
- package/src/generators/library/lib/update-app-routes.d.ts +3 -0
- package/src/generators/library/lib/update-app-routes.js +62 -0
- package/src/generators/library/library.d.ts +5 -0
- package/src/generators/library/library.js +193 -0
- package/src/generators/library/schema.d.ts +45 -0
- package/src/generators/library/schema.json +198 -0
- package/src/generators/redux/files/__fileName__.slice.spec.ts__tmpl__ +56 -0
- package/src/generators/redux/files/__fileName__.slice.ts__tmpl__ +129 -0
- package/src/generators/redux/redux.d.ts +5 -0
- package/src/generators/redux/redux.js +143 -0
- package/src/generators/redux/schema.d.ts +23 -0
- package/src/generators/redux/schema.json +51 -0
- package/src/generators/remote/files/common/src/main.js__tmpl__ +1 -0
- package/src/generators/remote/files/common/src/remote-entry.js__tmpl__ +1 -0
- package/src/generators/remote/files/common-ts/src/main.ts__tmpl__ +1 -0
- package/src/generators/remote/files/common-ts/src/remote-entry.ts__tmpl__ +1 -0
- package/src/generators/remote/files/module-federation/module-federation.config.js__tmpl__ +9 -0
- package/src/generators/remote/files/module-federation/webpack.config.js__tmpl__ +12 -0
- package/src/generators/remote/files/module-federation/webpack.config.prod.js__tmpl__ +1 -0
- package/src/generators/remote/files/module-federation-ssr/module-federation.server.config.js__tmpl__ +6 -0
- package/src/generators/remote/files/module-federation-ssr/server.ts__tmpl__ +45 -0
- package/src/generators/remote/files/module-federation-ssr/webpack.server.config.js__tmpl__ +12 -0
- package/src/generators/remote/files/module-federation-ssr-ts/module-federation.server.config.ts__tmpl__ +10 -0
- package/src/generators/remote/files/module-federation-ssr-ts/server.ts__tmpl__ +45 -0
- package/src/generators/remote/files/module-federation-ssr-ts/tsconfig.lint.json__tmpl__ +19 -0
- package/src/generators/remote/files/module-federation-ssr-ts/webpack.server.config.ts__tmpl__ +12 -0
- package/src/generators/remote/files/module-federation-ts/module-federation.config.ts__tmpl__ +13 -0
- package/src/generators/remote/files/module-federation-ts/tsconfig.lint.json__tmpl__ +19 -0
- package/src/generators/remote/files/module-federation-ts/webpack.config.prod.ts__tmpl__ +1 -0
- package/src/generators/remote/files/module-federation-ts/webpack.config.ts__tmpl__ +12 -0
- package/src/generators/remote/lib/add-remote-to-dynamic-host.d.ts +2 -0
- package/src/generators/remote/lib/add-remote-to-dynamic-host.js +11 -0
- package/src/generators/remote/lib/setup-ssr-for-remote.d.ts +4 -0
- package/src/generators/remote/lib/setup-ssr-for-remote.js +40 -0
- package/src/generators/remote/lib/setup-tspath-for-remote.d.ts +3 -0
- package/src/generators/remote/lib/setup-tspath-for-remote.js +15 -0
- package/src/generators/remote/lib/update-host-with-remote.d.ts +2 -0
- package/src/generators/remote/lib/update-host-with-remote.js +64 -0
- package/src/generators/remote/remote.d.ts +7 -0
- package/src/generators/remote/remote.js +104 -0
- package/src/generators/remote/schema.d.ts +34 -0
- package/src/generators/remote/schema.json +183 -0
- package/src/generators/setup-ssr/files/server.ts__tmpl__ +28 -0
- package/src/generators/setup-ssr/files/src/main.server.tsx__tmpl__ +47 -0
- package/src/generators/setup-ssr/files/tsconfig.server.json__tmpl__ +17 -0
- package/src/generators/setup-ssr/schema.d.ts +7 -0
- package/src/generators/setup-ssr/schema.json +48 -0
- package/src/generators/setup-ssr/setup-ssr.d.ts +4 -0
- package/src/generators/setup-ssr/setup-ssr.js +183 -0
- package/src/generators/setup-tailwind/files/postcss.config.js__tmpl__ +15 -0
- package/src/generators/setup-tailwind/files/tailwind.config.js__tmpl__ +17 -0
- package/src/generators/setup-tailwind/lib/add-tailwind-style-imports.d.ts +3 -0
- package/src/generators/setup-tailwind/lib/add-tailwind-style-imports.js +36 -0
- package/src/generators/setup-tailwind/lib/update-project.d.ts +3 -0
- package/src/generators/setup-tailwind/lib/update-project.js +13 -0
- package/src/generators/setup-tailwind/schema.d.ts +6 -0
- package/src/generators/setup-tailwind/schema.js +2 -0
- package/src/generators/setup-tailwind/schema.json +47 -0
- package/src/generators/setup-tailwind/setup-tailwind.d.ts +4 -0
- package/src/generators/setup-tailwind/setup-tailwind.js +35 -0
- package/src/generators/stories/schema.json +67 -0
- package/src/generators/stories/stories.d.ts +15 -0
- package/src/generators/stories/stories.js +130 -0
- package/src/generators/storybook-configuration/configuration.d.ts +6 -0
- package/src/generators/storybook-configuration/configuration.js +74 -0
- package/src/generators/storybook-configuration/schema.d.ts +16 -0
- package/src/generators/storybook-configuration/schema.json +95 -0
- package/src/migrations/update-15-3-0/install-webpack-rollup-dependencies.d.ts +3 -0
- package/src/migrations/update-15-3-0/install-webpack-rollup-dependencies.js +37 -0
- package/src/migrations/update-15-3-0/update-rollup-executor.d.ts +3 -0
- package/src/migrations/update-15-3-0/update-rollup-executor.js +15 -0
- package/src/migrations/update-15-6-3/webpack-config-setup.d.ts +2 -0
- package/src/migrations/update-15-6-3/webpack-config-setup.js +103 -0
- package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.d.ts +2 -0
- package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js +9 -0
- package/src/migrations/update-16-2-0-remove-package/update-16-2-0-remove-package.d.ts +2 -0
- package/src/migrations/update-16-2-0-remove-package/update-16-2-0-remove-package.js +8 -0
- package/src/migrations/update-16-3-0/remove-types-react-router-dom-package.d.ts +2 -0
- package/src/migrations/update-16-3-0/remove-types-react-router-dom-package.js +8 -0
- package/src/migrations/update-16-7-0/add-babel-core.d.ts +2 -0
- package/src/migrations/update-16-7-0/add-babel-core.js +14 -0
- package/src/migrations/update-16-7-0-add-typings/update-16-7-0-add-typings.d.ts +2 -0
- package/src/migrations/update-16-7-0-add-typings/update-16-7-0-add-typings.js +57 -0
- package/src/migrations/update-18-0-0/add-mf-env-var-to-target-defaults.d.ts +2 -0
- package/src/migrations/update-18-0-0/add-mf-env-var-to-target-defaults.js +26 -0
- package/src/module-federation/ast-utils.d.ts +8 -0
- package/src/module-federation/ast-utils.js +102 -0
- package/src/module-federation/load-config.d.ts +3 -0
- package/src/module-federation/load-config.js +16 -0
- package/src/module-federation/models.d.ts +24 -0
- package/src/module-federation/models.js +2 -0
- package/src/module-federation/package-json.d.ts +8 -0
- package/src/module-federation/package-json.js +13 -0
- package/src/module-federation/utils.d.ts +12 -0
- package/src/module-federation/utils.js +76 -0
- package/src/module-federation/with-module-federation-ssr.d.ts +2 -0
- package/src/module-federation/with-module-federation-ssr.js +34 -0
- package/src/module-federation/with-module-federation.d.ts +7 -0
- package/src/module-federation/with-module-federation.js +50 -0
- package/src/rules/add-styled-dependencies.d.ts +5 -0
- package/src/rules/add-styled-dependencies.js +17 -0
- package/src/rules/update-module-federation-project.d.ts +9 -0
- package/src/rules/update-module-federation-project.js +50 -0
- package/src/utils/add-mf-env-to-inputs.d.ts +2 -0
- package/src/utils/add-mf-env-to-inputs.js +24 -0
- package/src/utils/assertion.d.ts +1 -0
- package/src/utils/assertion.js +19 -0
- package/src/utils/ast-utils.d.ts +29 -0
- package/src/utils/ast-utils.js +522 -0
- package/src/utils/component-props.d.ts +15 -0
- package/src/utils/component-props.js +60 -0
- package/src/utils/create-ts-config.d.ts +9 -0
- package/src/utils/create-ts-config.js +65 -0
- package/src/utils/ct-utils.d.ts +14 -0
- package/src/utils/ct-utils.js +94 -0
- package/src/utils/dependencies.d.ts +7 -0
- package/src/utils/dependencies.js +2 -0
- package/src/utils/format-file.d.ts +1 -0
- package/src/utils/format-file.js +12 -0
- package/src/utils/get-in-source-vitest-tests-template.d.ts +1 -0
- package/src/utils/get-in-source-vitest-tests-template.js +21 -0
- package/src/utils/has-vite-plugin.d.ts +2 -0
- package/src/utils/has-vite-plugin.js +11 -0
- package/src/utils/has-webpack-plugin.d.ts +2 -0
- package/src/utils/has-webpack-plugin.js +11 -0
- package/src/utils/jest-utils.d.ts +1 -0
- package/src/utils/jest-utils.js +9 -0
- package/src/utils/lint.d.ts +36 -0
- package/src/utils/lint.js +24 -0
- package/src/utils/maybe-js.d.ts +3 -0
- package/src/utils/maybe-js.js +9 -0
- package/src/utils/styled.d.ts +3 -0
- package/src/utils/styled.js +62 -0
- package/src/utils/testing-generators.d.ts +3 -0
- package/src/utils/testing-generators.js +30 -0
- package/src/utils/versions.d.ts +46 -0
- package/src/utils/versions.js +54 -0
- package/tailwind.d.ts +6 -0
- package/tailwind.js +29 -0
- package/typings/cssmodule.d.ts +19 -0
- package/typings/image.d.ts +48 -0
- package/typings/style.d.ts +9 -0
- package/typings/styled-jsx.d.ts +8 -0
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.applicationGeneratorInternal = exports.applicationGenerator = void 0;
|
|
4
|
+
const lint_1 = require("../../utils/lint");
|
|
5
|
+
const create_application_files_1 = require("./lib/create-application-files");
|
|
6
|
+
const update_jest_config_1 = require("./lib/update-jest-config");
|
|
7
|
+
const normalize_options_1 = require("./lib/normalize-options");
|
|
8
|
+
const add_project_1 = require("./lib/add-project");
|
|
9
|
+
const add_jest_1 = require("./lib/add-jest");
|
|
10
|
+
const add_routing_1 = require("./lib/add-routing");
|
|
11
|
+
const set_defaults_1 = require("./lib/set-defaults");
|
|
12
|
+
const add_styled_dependencies_1 = require("../../rules/add-styled-dependencies");
|
|
13
|
+
const devkit_1 = require("@nx/devkit");
|
|
14
|
+
const init_1 = require("../init/init");
|
|
15
|
+
const eslint_1 = require("@nx/eslint");
|
|
16
|
+
const versions_1 = require("../../utils/versions");
|
|
17
|
+
const maybe_js_1 = require("../../utils/maybe-js");
|
|
18
|
+
const install_common_dependencies_1 = require("./lib/install-common-dependencies");
|
|
19
|
+
const create_ts_config_1 = require("../../utils/create-ts-config");
|
|
20
|
+
const add_swc_dependencies_1 = require("@nx/js/src/utils/swc/add-swc-dependencies");
|
|
21
|
+
const chalk = require("chalk");
|
|
22
|
+
const show_possible_warnings_1 = require("./lib/show-possible-warnings");
|
|
23
|
+
const add_e2e_1 = require("./lib/add-e2e");
|
|
24
|
+
const eslint_file_1 = require("@nx/eslint/src/generators/utils/eslint-file");
|
|
25
|
+
const js_1 = require("@nx/js");
|
|
26
|
+
const log_show_project_command_1 = require("@nx/devkit/src/utils/log-show-project-command");
|
|
27
|
+
const setup_tailwind_1 = require("../setup-tailwind/setup-tailwind");
|
|
28
|
+
async function addLinting(host, options) {
|
|
29
|
+
const tasks = [];
|
|
30
|
+
if (options.linter === eslint_1.Linter.EsLint) {
|
|
31
|
+
const lintTask = await (0, eslint_1.lintProjectGenerator)(host, {
|
|
32
|
+
linter: options.linter,
|
|
33
|
+
project: options.projectName,
|
|
34
|
+
tsConfigPaths: [
|
|
35
|
+
(0, devkit_1.joinPathFragments)(options.appProjectRoot, 'tsconfig.app.json'),
|
|
36
|
+
],
|
|
37
|
+
unitTestRunner: options.unitTestRunner,
|
|
38
|
+
skipFormat: true,
|
|
39
|
+
rootProject: options.rootProject,
|
|
40
|
+
skipPackageJson: options.skipPackageJson,
|
|
41
|
+
addPlugin: options.addPlugin,
|
|
42
|
+
});
|
|
43
|
+
tasks.push(lintTask);
|
|
44
|
+
if ((0, eslint_file_1.isEslintConfigSupported)(host)) {
|
|
45
|
+
(0, eslint_file_1.addExtendsToLintConfig)(host, options.appProjectRoot, 'plugin:@nx/react');
|
|
46
|
+
}
|
|
47
|
+
if (!options.skipPackageJson) {
|
|
48
|
+
const installTask = (0, devkit_1.addDependenciesToPackageJson)(host, lint_1.extraEslintDependencies.dependencies, lint_1.extraEslintDependencies.devDependencies);
|
|
49
|
+
const addSwcTask = (0, add_swc_dependencies_1.addSwcDependencies)(host);
|
|
50
|
+
tasks.push(installTask, addSwcTask);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
54
|
+
}
|
|
55
|
+
async function applicationGenerator(host, schema) {
|
|
56
|
+
return await applicationGeneratorInternal(host, {
|
|
57
|
+
addPlugin: false,
|
|
58
|
+
projectNameAndRootFormat: 'derived',
|
|
59
|
+
...schema,
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
exports.applicationGenerator = applicationGenerator;
|
|
63
|
+
async function applicationGeneratorInternal(host, schema) {
|
|
64
|
+
const tasks = [];
|
|
65
|
+
console.log('Well hello Katerina!');
|
|
66
|
+
const options = await (0, normalize_options_1.normalizeOptions)(host, schema);
|
|
67
|
+
(0, show_possible_warnings_1.showPossibleWarnings)(host, options);
|
|
68
|
+
const jsInitTask = await (0, js_1.initGenerator)(host, {
|
|
69
|
+
...schema,
|
|
70
|
+
tsConfigName: schema.rootProject ? 'tsconfig.json' : 'tsconfig.base.json',
|
|
71
|
+
skipFormat: true,
|
|
72
|
+
});
|
|
73
|
+
tasks.push(jsInitTask);
|
|
74
|
+
const initTask = await (0, init_1.default)(host, {
|
|
75
|
+
...options,
|
|
76
|
+
skipFormat: true,
|
|
77
|
+
});
|
|
78
|
+
tasks.push(initTask);
|
|
79
|
+
if (options.bundler === 'webpack') {
|
|
80
|
+
const { webpackInitGenerator } = (0, devkit_1.ensurePackage)('@nx/webpack', versions_1.nxVersion);
|
|
81
|
+
const webpackInitTask = await webpackInitGenerator(host, {
|
|
82
|
+
skipPackageJson: options.skipPackageJson,
|
|
83
|
+
skipFormat: true,
|
|
84
|
+
addPlugin: options.addPlugin,
|
|
85
|
+
});
|
|
86
|
+
tasks.push(webpackInitTask);
|
|
87
|
+
if (!options.skipPackageJson) {
|
|
88
|
+
const { ensureDependencies } = await Promise.resolve().then(() => require('@nx/webpack/src/utils/ensure-dependencies'));
|
|
89
|
+
tasks.push(ensureDependencies(host, { uiFramework: 'react' }));
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
if (!options.rootProject) {
|
|
93
|
+
(0, create_ts_config_1.extractTsConfigBase)(host);
|
|
94
|
+
}
|
|
95
|
+
(0, create_application_files_1.createApplicationFiles)(host, options);
|
|
96
|
+
(0, add_project_1.addProject)(host, options);
|
|
97
|
+
if (options.style === 'tailwind') {
|
|
98
|
+
const twTask = await (0, setup_tailwind_1.setupTailwindGenerator)(host, {
|
|
99
|
+
project: options.projectName,
|
|
100
|
+
});
|
|
101
|
+
tasks.push(twTask);
|
|
102
|
+
}
|
|
103
|
+
if (options.bundler === 'vite') {
|
|
104
|
+
const { createOrEditViteConfig, viteConfigurationGenerator } = (0, devkit_1.ensurePackage)('@nx/vite', versions_1.nxVersion);
|
|
105
|
+
// We recommend users use `import.meta.env.MODE` and other variables in their code to differentiate between production and development.
|
|
106
|
+
// See: https://vitejs.dev/guide/env-and-mode.html
|
|
107
|
+
if (host.exists((0, devkit_1.joinPathFragments)(options.appProjectRoot, 'src/environments'))) {
|
|
108
|
+
host.delete((0, devkit_1.joinPathFragments)(options.appProjectRoot, 'src/environments'));
|
|
109
|
+
}
|
|
110
|
+
const viteTask = await viteConfigurationGenerator(host, {
|
|
111
|
+
uiFramework: 'react',
|
|
112
|
+
project: options.projectName,
|
|
113
|
+
newProject: true,
|
|
114
|
+
includeVitest: options.unitTestRunner === 'vitest',
|
|
115
|
+
inSourceTests: options.inSourceTests,
|
|
116
|
+
compiler: options.compiler,
|
|
117
|
+
skipFormat: true,
|
|
118
|
+
addPlugin: options.addPlugin,
|
|
119
|
+
});
|
|
120
|
+
tasks.push(viteTask);
|
|
121
|
+
createOrEditViteConfig(host, {
|
|
122
|
+
project: options.projectName,
|
|
123
|
+
includeLib: false,
|
|
124
|
+
includeVitest: options.unitTestRunner === 'vitest',
|
|
125
|
+
inSourceTests: options.inSourceTests,
|
|
126
|
+
rollupOptionsExternal: [
|
|
127
|
+
"'react'",
|
|
128
|
+
"'react-dom'",
|
|
129
|
+
"'react/jsx-runtime'",
|
|
130
|
+
],
|
|
131
|
+
imports: [
|
|
132
|
+
options.compiler === 'swc'
|
|
133
|
+
? `import react from '@vitejs/plugin-react-swc'`
|
|
134
|
+
: `import react from '@vitejs/plugin-react'`,
|
|
135
|
+
],
|
|
136
|
+
plugins: ['react()'],
|
|
137
|
+
}, false);
|
|
138
|
+
}
|
|
139
|
+
else if (options.bundler === 'rspack') {
|
|
140
|
+
const { configurationGenerator } = (0, devkit_1.ensurePackage)('@nx/rspack', versions_1.nxRspackVersion);
|
|
141
|
+
const rspackTask = await configurationGenerator(host, {
|
|
142
|
+
project: options.projectName,
|
|
143
|
+
main: (0, devkit_1.joinPathFragments)(options.appProjectRoot, (0, maybe_js_1.maybeJs)(options, `src/main.tsx`)),
|
|
144
|
+
tsConfig: (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'tsconfig.app.json'),
|
|
145
|
+
target: 'web',
|
|
146
|
+
newProject: true,
|
|
147
|
+
uiFramework: 'react',
|
|
148
|
+
});
|
|
149
|
+
tasks.push(rspackTask);
|
|
150
|
+
}
|
|
151
|
+
if (options.bundler !== 'vite' && options.unitTestRunner === 'vitest') {
|
|
152
|
+
const { createOrEditViteConfig, vitestGenerator } = (0, devkit_1.ensurePackage)('@nx/vite', versions_1.nxVersion);
|
|
153
|
+
const vitestTask = await vitestGenerator(host, {
|
|
154
|
+
uiFramework: 'react',
|
|
155
|
+
coverageProvider: 'v8',
|
|
156
|
+
project: options.projectName,
|
|
157
|
+
inSourceTests: options.inSourceTests,
|
|
158
|
+
skipFormat: true,
|
|
159
|
+
addPlugin: options.addPlugin,
|
|
160
|
+
});
|
|
161
|
+
tasks.push(vitestTask);
|
|
162
|
+
createOrEditViteConfig(host, {
|
|
163
|
+
project: options.projectName,
|
|
164
|
+
includeLib: false,
|
|
165
|
+
includeVitest: true,
|
|
166
|
+
inSourceTests: options.inSourceTests,
|
|
167
|
+
rollupOptionsExternal: [
|
|
168
|
+
"'react'",
|
|
169
|
+
"'react-dom'",
|
|
170
|
+
"'react/jsx-runtime'",
|
|
171
|
+
],
|
|
172
|
+
imports: [
|
|
173
|
+
options.compiler === 'swc'
|
|
174
|
+
? `import react from '@vitejs/plugin-react-swc'`
|
|
175
|
+
: `import react from '@vitejs/plugin-react'`,
|
|
176
|
+
],
|
|
177
|
+
plugins: ['react()'],
|
|
178
|
+
}, true);
|
|
179
|
+
}
|
|
180
|
+
if ((options.bundler === 'vite' || options.unitTestRunner === 'vitest') &&
|
|
181
|
+
options.inSourceTests) {
|
|
182
|
+
host.delete((0, devkit_1.joinPathFragments)(options.appProjectRoot, `src/app/${options.fileName}.spec.tsx`));
|
|
183
|
+
}
|
|
184
|
+
const lintTask = await addLinting(host, options);
|
|
185
|
+
tasks.push(lintTask);
|
|
186
|
+
const e2eTask = await (0, add_e2e_1.addE2e)(host, options);
|
|
187
|
+
tasks.push(e2eTask);
|
|
188
|
+
if (options.unitTestRunner === 'jest') {
|
|
189
|
+
const jestTask = await (0, add_jest_1.addJest)(host, options);
|
|
190
|
+
tasks.push(jestTask);
|
|
191
|
+
}
|
|
192
|
+
// Handle tsconfig.spec.json for jest or vitest
|
|
193
|
+
(0, update_jest_config_1.updateSpecConfig)(host, options);
|
|
194
|
+
const stylePreprocessorTask = (0, install_common_dependencies_1.installCommonDependencies)(host, options);
|
|
195
|
+
tasks.push(stylePreprocessorTask);
|
|
196
|
+
const styledTask = (0, add_styled_dependencies_1.addStyledModuleDependencies)(host, options);
|
|
197
|
+
tasks.push(styledTask);
|
|
198
|
+
const routingTask = (0, add_routing_1.addRouting)(host, options);
|
|
199
|
+
tasks.push(routingTask);
|
|
200
|
+
(0, set_defaults_1.setDefaults)(host, options);
|
|
201
|
+
if (options.bundler === 'rspack' && options.style === 'styled-jsx') {
|
|
202
|
+
devkit_1.logger.warn(`${chalk.bold('styled-jsx')} is not supported by ${chalk.bold('Rspack')}. We've added ${chalk.bold('babel-loader')} to your project, but using babel will slow down your build.`);
|
|
203
|
+
tasks.push((0, devkit_1.addDependenciesToPackageJson)(host, {}, { 'babel-loader': versions_1.babelLoaderVersion }));
|
|
204
|
+
host.write((0, devkit_1.joinPathFragments)(options.appProjectRoot, 'rspack.config.js'), (0, devkit_1.stripIndents) `
|
|
205
|
+
const { composePlugins, withNx, withWeb } = require('@nx/rspack');
|
|
206
|
+
module.exports = composePlugins(withNx(), withWeb(), (config) => {
|
|
207
|
+
config.module.rules.push({
|
|
208
|
+
test: /\\.[jt]sx$/i,
|
|
209
|
+
use: [
|
|
210
|
+
{
|
|
211
|
+
loader: 'babel-loader',
|
|
212
|
+
options: {
|
|
213
|
+
presets: ['@babel/preset-typescript'],
|
|
214
|
+
plugins: ['styled-jsx/babel'],
|
|
215
|
+
},
|
|
216
|
+
},
|
|
217
|
+
],
|
|
218
|
+
});
|
|
219
|
+
return config;
|
|
220
|
+
});
|
|
221
|
+
`);
|
|
222
|
+
}
|
|
223
|
+
if (!options.skipFormat) {
|
|
224
|
+
await (0, devkit_1.formatFiles)(host);
|
|
225
|
+
}
|
|
226
|
+
tasks.push(() => {
|
|
227
|
+
(0, log_show_project_command_1.logShowProjectCommand)(options.projectName);
|
|
228
|
+
});
|
|
229
|
+
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
230
|
+
}
|
|
231
|
+
exports.applicationGeneratorInternal = applicationGeneratorInternal;
|
|
232
|
+
exports.default = applicationGenerator;
|
|
File without changes
|
|
Binary file
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<title><%= className %></title>
|
|
6
|
+
<base href="/" />
|
|
7
|
+
|
|
8
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
9
|
+
<link rel="icon" type="image/x-icon" href="favicon.ico" />
|
|
10
|
+
</head>
|
|
11
|
+
<body>
|
|
12
|
+
<div id="root"></div>
|
|
13
|
+
</body>
|
|
14
|
+
</html>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<% if (strict) { %>import { StrictMode } from 'react';<% } %>
|
|
2
|
+
import * as ReactDOM from 'react-dom/client';
|
|
3
|
+
<% if (routing) { %>import { BrowserRouter } from 'react-router-dom';<% } %>
|
|
4
|
+
|
|
5
|
+
import App from './app/<%= fileName %>';
|
|
6
|
+
|
|
7
|
+
const root = ReactDOM.createRoot(document.getElementById('root') as HTMLElement);
|
|
8
|
+
root.render(
|
|
9
|
+
<% if (strict) { %><StrictMode><% } %><% if (routing) { %><BrowserRouter><% } %><App /><% if (routing) { %></BrowserRouter><% } %><% if (strict) { %></StrictMode><% } %>
|
|
10
|
+
);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "./tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"outDir": "<%= offsetFromRoot %>dist/out-tsc",
|
|
5
|
+
"types": [
|
|
6
|
+
"node",
|
|
7
|
+
<% if (style === 'styled-jsx') { %>"@nx/react/typings/styled-jsx.d.ts",<% } %>
|
|
8
|
+
"@nx/react/typings/cssmodule.d.ts",
|
|
9
|
+
"@nx/react/typings/image.d.ts"
|
|
10
|
+
]
|
|
11
|
+
},
|
|
12
|
+
"exclude": ["jest.config.ts","src/**/*.spec.ts", "src/**/*.test.ts", "src/**/*.spec.tsx", "src/**/*.test.tsx", "src/**/*.spec.js", "src/**/*.test.js", "src/**/*.spec.jsx", "src/**/*.test.jsx"],
|
|
13
|
+
"include": ["src/**/*.js", "src/**/*.jsx", "src/**/*.ts", "src/**/*.tsx"]
|
|
14
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<title><%= className %></title>
|
|
6
|
+
<base href="/" />
|
|
7
|
+
|
|
8
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
9
|
+
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
|
|
10
|
+
<% if (!styledModule && style !== 'none') { %><link rel="stylesheet" href="/src/styles.<%= style === 'tailwind' ? 'css' : style %>" /><% } %>
|
|
11
|
+
</head>
|
|
12
|
+
<body>
|
|
13
|
+
<div id="root"></div>
|
|
14
|
+
<script type="module" src="/src/main.tsx"></script>
|
|
15
|
+
</body>
|
|
16
|
+
</html>
|
|
Binary file
|
|
File without changes
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<% if (strict) { %>import { StrictMode } from 'react';<% } %>
|
|
2
|
+
import * as ReactDOM from 'react-dom/client';
|
|
3
|
+
<% if (routing) { %>import { BrowserRouter } from 'react-router-dom';<% } %>
|
|
4
|
+
|
|
5
|
+
import App from './app/<%= fileName %>';
|
|
6
|
+
|
|
7
|
+
const root = ReactDOM.createRoot(document.getElementById('root') as HTMLElement);
|
|
8
|
+
root.render(
|
|
9
|
+
<% if (strict) { %><StrictMode><% } %><% if (routing) { %><BrowserRouter><% } %><App /><% if (routing) { %></BrowserRouter><% } %><% if (strict) { %></StrictMode><% } %>
|
|
10
|
+
);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "./tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"outDir": "<%= offsetFromRoot %>dist/out-tsc",
|
|
5
|
+
"types": [
|
|
6
|
+
"node",
|
|
7
|
+
<% if (style === 'styled-jsx') { %>"@nx/react/typings/styled-jsx.d.ts",<% } %>
|
|
8
|
+
"@nx/react/typings/cssmodule.d.ts",
|
|
9
|
+
"@nx/react/typings/image.d.ts"
|
|
10
|
+
]
|
|
11
|
+
},
|
|
12
|
+
"exclude": ["src/**/*.spec.ts", "src/**/*.test.ts", "src/**/*.spec.tsx", "src/**/*.test.tsx", "src/**/*.spec.js", "src/**/*.test.js", "src/**/*.spec.jsx", "src/**/*.test.jsx"],
|
|
13
|
+
"include": ["src/**/*.js", "src/**/*.jsx", "src/**/*.ts", "src/**/*.tsx"]
|
|
14
|
+
}
|
|
File without changes
|
|
Binary file
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<title><%= className %></title>
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
7
|
+
<link rel="icon" type="image/x-icon" href="favicon.ico" />
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
<div id="root"></div>
|
|
11
|
+
</body>
|
|
12
|
+
</html>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<% if (strict) { %>import { StrictMode } from 'react';<% } %>
|
|
2
|
+
import * as ReactDOM from 'react-dom/client';
|
|
3
|
+
<% if (routing) { %>import { BrowserRouter } from 'react-router-dom';<% } %>
|
|
4
|
+
|
|
5
|
+
import App from './app/<%= fileName %>';
|
|
6
|
+
|
|
7
|
+
const root = ReactDOM.createRoot(document.getElementById('root') as HTMLElement);
|
|
8
|
+
root.render(
|
|
9
|
+
<% if (strict) { %><StrictMode><% } %><% if (routing) { %><BrowserRouter><% } %><App /><% if (routing) { %></BrowserRouter><% } %><% if (strict) { %></StrictMode><% } %>
|
|
10
|
+
);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "./tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"outDir": "<%= offsetFromRoot %>dist/out-tsc",
|
|
5
|
+
"types": [
|
|
6
|
+
"node",
|
|
7
|
+
<% if (style === 'styled-jsx') { %>"@nx/react/typings/styled-jsx.d.ts",<% } %>
|
|
8
|
+
"@nx/react/typings/cssmodule.d.ts",
|
|
9
|
+
"@nx/react/typings/image.d.ts"
|
|
10
|
+
]
|
|
11
|
+
},
|
|
12
|
+
"exclude": ["jest.config.ts","src/**/*.spec.ts", "src/**/*.test.ts", "src/**/*.spec.tsx", "src/**/*.test.tsx", "src/**/*.spec.js", "src/**/*.test.js", "src/**/*.spec.jsx", "src/**/*.test.jsx"],
|
|
13
|
+
"include": ["src/**/*.js", "src/**/*.jsx", "src/**/*.ts", "src/**/*.tsx"]
|
|
14
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
<% if (webpackPluginOptions) { %>
|
|
2
|
+
const { NxWebpackPlugin } = require('@nx/webpack');
|
|
3
|
+
const { NxReactWebpackPlugin } = require('@nx/react');
|
|
4
|
+
const { join } = require('path');
|
|
5
|
+
|
|
6
|
+
module.exports = {
|
|
7
|
+
output: {
|
|
8
|
+
path: join(__dirname, '<%= offsetFromRoot %><%= webpackPluginOptions.outputPath %>'),
|
|
9
|
+
},
|
|
10
|
+
devServer: {
|
|
11
|
+
port: 4200
|
|
12
|
+
},
|
|
13
|
+
plugins: [
|
|
14
|
+
new NxWebpackPlugin({
|
|
15
|
+
tsConfig: '<%= webpackPluginOptions.tsConfig %>',
|
|
16
|
+
compiler: '<%= webpackPluginOptions.compiler %>',
|
|
17
|
+
main: '<%= webpackPluginOptions.main %>',
|
|
18
|
+
index: '<%= webpackPluginOptions.index %>',
|
|
19
|
+
baseHref: '<%= webpackPluginOptions.baseHref %>',
|
|
20
|
+
assets: <%- JSON.stringify(webpackPluginOptions.assets) %>,
|
|
21
|
+
styles: <%- JSON.stringify(webpackPluginOptions.styles) %>,
|
|
22
|
+
outputHashing: process.env['NODE_ENV'] === 'production' ? 'all' : 'none',
|
|
23
|
+
optimization: process.env['NODE_ENV'] === 'production',
|
|
24
|
+
}),
|
|
25
|
+
new NxReactWebpackPlugin({
|
|
26
|
+
// Uncomment this line if you don't want to use SVGR
|
|
27
|
+
// See: https://react-svgr.com/
|
|
28
|
+
// svgr: false
|
|
29
|
+
}),
|
|
30
|
+
],
|
|
31
|
+
};
|
|
32
|
+
<% } else { %>
|
|
33
|
+
const { composePlugins, withNx } = require('@nx/webpack');
|
|
34
|
+
const { withReact } = require('@nx/react');
|
|
35
|
+
|
|
36
|
+
// Nx plugins for webpack.
|
|
37
|
+
module.exports = composePlugins(
|
|
38
|
+
withNx(),
|
|
39
|
+
withReact({
|
|
40
|
+
// Uncomment this line if you don't want to use SVGR
|
|
41
|
+
// See: https://react-svgr.com/
|
|
42
|
+
// svgr: false
|
|
43
|
+
}),
|
|
44
|
+
(config) => {
|
|
45
|
+
// Update the webpack config as needed here.
|
|
46
|
+
// e.g. `config.plugins.push(new MyPlugin())`
|
|
47
|
+
return config;
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
<% } %>
|