diff --git a/demos/basic-v16-rspack/babel.config.js b/demos/basic-v16-rspack/babel.config.js deleted file mode 100644 index 9953e2a..0000000 --- a/demos/basic-v16-rspack/babel.config.js +++ /dev/null @@ -1,36 +0,0 @@ -// The source code including full typescript support is available at: -// https://github.com/shakacode/react_on_rails_demo_ssr_hmr/blob/master/babel.config.js - -module.exports = function (api) { - const defaultConfigFunc = require('shakapacker/package/babel/preset.js') - const resultConfig = defaultConfigFunc(api) - const isProductionEnv = api.env('production') - - const changesOnDefault = { - presets: [ - [ - '@babel/preset-react', - { - development: !isProductionEnv, - useBuiltIns: true, - runtime: 'automatic' - } - ] - ].filter(Boolean), - plugins: [ - // Enable React Refresh (Fast Refresh) only when webpack-dev-server is running (HMR mode) - // This prevents React Refresh from trying to connect when using static compilation - !isProductionEnv && process.env.WEBPACK_SERVE && 'react-refresh/babel', - isProductionEnv && ['babel-plugin-transform-react-remove-prop-types', - { - removeImport: true - } - ] - ].filter(Boolean), - } - - resultConfig.presets = [...resultConfig.presets, ...changesOnDefault.presets] - resultConfig.plugins = [...resultConfig.plugins, ...changesOnDefault.plugins ] - - return resultConfig -} diff --git a/demos/basic-v16-rspack/bin/export-bundler-config b/demos/basic-v16-rspack/bin/export-bundler-config new file mode 100755 index 0000000..42fc1ba --- /dev/null +++ b/demos/basic-v16-rspack/bin/export-bundler-config @@ -0,0 +1,11 @@ +#!/usr/bin/env node + +// Minimal shim - all logic is in the TypeScript module +const { run } = require('shakapacker/configExporter') + +run(process.argv.slice(2)) + .then((exitCode) => process.exit(exitCode)) + .catch((error) => { + console.error(error.message) + process.exit(1) + }) diff --git a/demos/basic-v16-rspack/bin/shakapacker b/demos/basic-v16-rspack/bin/shakapacker index 8f81c58..e9c4185 100755 --- a/demos/basic-v16-rspack/bin/shakapacker +++ b/demos/basic-v16-rspack/bin/shakapacker @@ -1,5 +1,4 @@ #!/usr/bin/env ruby -# frozen_string_literal: true ENV["RAILS_ENV"] ||= "development" ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__) diff --git a/demos/basic-v16-rspack/bin/shakapacker-dev-server b/demos/basic-v16-rspack/bin/shakapacker-dev-server index f02dcb3..4ce226e 100755 --- a/demos/basic-v16-rspack/bin/shakapacker-dev-server +++ b/demos/basic-v16-rspack/bin/shakapacker-dev-server @@ -1,5 +1,4 @@ #!/usr/bin/env ruby -# frozen_string_literal: true ENV["RAILS_ENV"] ||= "development" ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)