Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions variants/frontend-base-typescript/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,14 @@ declare module '*.jpg' {
const content: string;
export default content;
}

// todo: even though shakapacker ships with its own types, it currently types
// itself as "any" which will hopefully change in a future version
declare module 'shakapacker' {
import { Configuration } from 'webpack';

export function generateWebpackConfig(
extraConfig?: Configuration
): Configuration;
export * from 'webpack-merge';
}
26 changes: 17 additions & 9 deletions variants/frontend-base/template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,24 @@

run "rails shakapacker:install"

# ensure the latest major versions of Shakapacker's peer dependencies are installed
#
# TODO: remove this once https://github.com/shakacode/shakapacker/pull/576 is landed
# install dependencies for babel and webpack
add_js_dependencies [
"babel-loader@10",
"compression-webpack-plugin@11",
"webpack-assets-manifest@6",
"webpack-cli@6",
"webpack-merge@6"
"@babel/core",
"@babel/plugin-transform-runtime",
"@babel/preset-env",
"@babel/runtime",
"babel-loader",
"compression-webpack-plugin",
"css-loader",
"mini-css-extract-plugin",
"sass-loader",
"style-loader",
"terser-webpack-plugin",
"webpack-assets-manifest",
"webpack-cli",
"webpack-merge"
]
add_js_dependencies ["webpack-dev-server@5"], type: :dev
add_js_dependencies ["webpack-dev-server"], type: :dev

# this is added by shakapacker:install, but we've already got one (with some extra tags)
# in our template, so remove theirs otherwise the app will error when rendering this
Expand All @@ -48,6 +55,7 @@
copy_file "config/webpack/webpack.config.js", force: true

gsub_file! "config/shakapacker.yml", "cache_path: tmp/shakapacker", "cache_path: tmp/cache/shakapacker"
gsub_file! "config/shakapacker.yml", "javascript_transpiler: 'swc'", "javascript_transpiler: 'babel'"
gsub_file! "config/shakapacker.yml", "source_path: app/javascript", "source_path: app/frontend"

old_shakapacker_test_compile_snippet = <<~EO_OLD
Expand Down
Loading