Install and setup Stimulus
This commit is contained in:
parent
bf5d1c73d1
commit
58d8c827e0
|
@ -1,5 +1,8 @@
|
|||
require('../styles/application.scss');
|
||||
|
||||
import { Application } from '@hotwired/stimulus';
|
||||
import { definitionsFromContext } from '@hotwired/stimulus-webpack-helpers';
|
||||
|
||||
import start from 'retrospring/common';
|
||||
import initAnnouncements from 'retrospring/features/announcement';
|
||||
import initAnswerbox from 'retrospring/features/answerbox/index';
|
||||
|
@ -27,3 +30,7 @@ document.addEventListener('DOMContentLoaded', initMemes);
|
|||
document.addEventListener('turbo:load', initAnnouncements);
|
||||
document.addEventListener('turbo:load', initLocales);
|
||||
document.addEventListener('turbo:load', initFront);
|
||||
|
||||
window['Stimulus'] = Application.start();
|
||||
const context = require.context('../retrospring/controllers', true, /\.ts$/);
|
||||
window['Stimulus'].load(definitionsFromContext(context));
|
||||
|
|
|
@ -35,12 +35,12 @@ module.exports = function(api) {
|
|||
exclude: ['transform-typeof-symbol']
|
||||
}
|
||||
],
|
||||
['@babel/preset-typescript', { 'allExtensions': true, 'isTSX': true }]
|
||||
].filter(Boolean),
|
||||
plugins: [
|
||||
'babel-plugin-macros',
|
||||
'@babel/plugin-syntax-dynamic-import',
|
||||
isTestEnv && 'babel-plugin-dynamic-import-node',
|
||||
["@babel/plugin-transform-typescript", { 'allExtensions': true, 'isTSX': true, 'allowDeclareFields': true }],
|
||||
'@babel/plugin-transform-destructuring',
|
||||
[
|
||||
'@babel/plugin-proposal-class-properties',
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"@babel/preset-typescript": "^7.18.6",
|
||||
"@hotwired/stimulus": "^3.1.0",
|
||||
"@hotwired/stimulus-webpack-helpers": "^1.0.1",
|
||||
"@hotwired/turbo-rails": "^7.1.3",
|
||||
"@melloware/coloris": "^0.16.0",
|
||||
"@rails/request.js": "^0.0.6",
|
||||
|
|
10
yarn.lock
10
yarn.lock
|
@ -1086,6 +1086,16 @@
|
|||
resolved "https://registry.yarnpkg.com/@gar/promisify/-/promisify-1.1.2.tgz#30aa825f11d438671d585bd44e7fd564535fc210"
|
||||
integrity sha512-82cpyJyKRoQoRi+14ibCeGPu0CwypgtBAdBhq1WfvagpCZNKqwXbKwXllYSMG91DhmG4jt9gN8eP6lGOtozuaw==
|
||||
|
||||
"@hotwired/stimulus-webpack-helpers@^1.0.1":
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/@hotwired/stimulus-webpack-helpers/-/stimulus-webpack-helpers-1.0.1.tgz#4cd74487adeca576c9865ac2b9fe5cb20cef16dd"
|
||||
integrity sha512-wa/zupVG0eWxRYJjC1IiPBdt3Lruv0RqGN+/DTMmUWUyMAEB27KXmVY6a8YpUVTM7QwVuaLNGW4EqDgrS2upXQ==
|
||||
|
||||
"@hotwired/stimulus@^3.1.0":
|
||||
version "3.1.0"
|
||||
resolved "https://registry.yarnpkg.com/@hotwired/stimulus/-/stimulus-3.1.0.tgz#20215251e5afe6e0a3787285181ba1bfc9097df0"
|
||||
integrity sha512-iDMHUhiEJ1xFeicyHcZQQgBzhtk5mPR0QZO3L6wtqzMsJEk2TKECuCQTGKjm+KJTHVY0dKq1dOOAWvODjpd2Mg==
|
||||
|
||||
"@hotwired/turbo-rails@^7.1.0", "@hotwired/turbo-rails@^7.1.3":
|
||||
version "7.1.3"
|
||||
resolved "https://registry.yarnpkg.com/@hotwired/turbo-rails/-/turbo-rails-7.1.3.tgz#a4e04ecb800a06e7f9aa6e298170fa4580b74216"
|
||||
|
|
Loading…
Reference in New Issue