-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature: Replace Webpack with Esbuild (#4725)
Because: - Faster JS compiling! This commit: - Adds rails JS bundling gem to handle the esbuild integration with the asset pipeline - Removes Webpack and its plugins - Adds Esbuild - Use a custom Esbuild config file so we can configure prism and the esbuild rails plugins - Renames application.js to main.js because... - We are importing CSS for some of our dependencies like Flatpickr and Tippy.js - Esbuild builds and names its output file the same name as the entrypoint file - javascript/application.js -> builds/application.js and builds/application.css - This was conflicting with our application.css file used with tailwind. - Renaming the entrypoint to main.js produces builds/main.js and builds/main.css files which will not conflict
- Loading branch information
1 parent
ac8ba2a
commit 2aba826
Showing
24 changed files
with
1,044 additions
and
4,314 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
public/packs | ||
tmp/cache/assets | ||
tmp/cache/webpacker | ||
~/.cache/yarn | ||
node_modules | ||
tmp/cache/bootsnap-load-path-cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
"es2021": true | ||
}, | ||
"extends": [ | ||
"airbnb" | ||
"airbnb-base" | ||
], | ||
"parserOptions": { | ||
"ecmaVersion": 12 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
web: bundle exec puma -C config/puma_development.rb -p 3000 | ||
worker: bundle exec sidekiq | ||
webpack: bin/webpacker-dev-server | ||
css: yarn build:css --watch | ||
js: yarn build --watch |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,22 @@ | ||
// Load all the controllers within this directory and all subdirectories. | ||
// Controller files must be named *_controller.js. | ||
|
||
/* eslint-disable import/extensions, import/no-unresolved */ | ||
import { Application } from '@hotwired/stimulus'; | ||
import { definitionsFromContext } from '@hotwired/stimulus-webpack-helpers'; | ||
import controllers from './*_controller.js'; | ||
import componentControllers from '../../components/**/*_controller.js'; | ||
|
||
const application = Application.start(); | ||
const context = require.context('controllers', true, /_controller\.js$/); | ||
const contextComponents = require.context('../../components', true, /_controller\.js$/); | ||
|
||
application.load( | ||
definitionsFromContext(context).concat( | ||
definitionsFromContext(contextComponents), | ||
), | ||
); | ||
|
||
// Register componentControllers from "../../components/**/*_controller.js" | ||
componentControllers.forEach((controller) => { | ||
application.register(controller.name.replace('..--..--components--', ''), controller.module.default); | ||
}); | ||
|
||
// Register controllers from "./*_controller.js" | ||
controllers.forEach((controller) => { | ||
application.register(controller.name, controller.module.default); | ||
}); | ||
|
||
// Configure Stimulus development experience | ||
application.debug = false; | ||
window.Stimulus = application; | ||
|
||
export default application; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import 'core-js/stable'; | ||
import 'regenerator-runtime/runtime'; | ||
import './controllers'; | ||
import '@hotwired/turbo-rails'; | ||
import './src/custom_turbo_stream_actions'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
#!/usr/bin/env bash | ||
#!/usr/bin/env sh | ||
|
||
if ! command -v foreman &> /dev/null | ||
then | ||
echo 'Installing foreman...' | ||
if gem list --no-installed --exact --silent foreman; then | ||
echo "Installing foreman..." | ||
gem install foreman | ||
fi | ||
|
||
foreman start -f Procfile.dev | ||
# Default to port 3000 if not specified | ||
export PORT="${PORT:-3000}" | ||
|
||
exec foreman start -f Procfile.dev --env /dev/null "$@" |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.