Add aliases for common module locations

This commit is contained in:
Andreas Nedbal 2021-12-25 00:02:52 +01:00
parent fcd7217126
commit 89127aa313
6 changed files with 23 additions and 10 deletions

View File

@ -1,6 +1,6 @@
import start from '../retrospring/common';
import initAnswerbox from '../retrospring/features/answerbox/index';
import initInbox from '../retrospring/features/inbox/index';
import start from 'retrospring/common';
import initAnswerbox from 'retrospring/features/answerbox/index';
import initInbox from 'retrospring/features/inbox/index';
start();
document.addEventListener('turbolinks:load', initAnswerbox);

View File

@ -1,5 +1,5 @@
import registerEvents from "retrospring/utilities/registerEvents";
import {createShareEvent} from "./share";
import registerEvents from 'utilities/registerEvents';
import { createShareEvent } from './share';
export default (): void => {
if ('share' in navigator) {

View File

@ -1,4 +1,4 @@
import noop from 'retrospring/utilities/noop';
import noop from 'utilities/noop';
export function createShareEvent(answerbox: HTMLElement): () => void {
return function (): void {

View File

@ -1,12 +1,12 @@
import registerEvents from "retrospring/utilities/registerEvents";
import {reportEventHandler} from "./report";
import registerEvents from 'utilities/registerEvents';
import { reportEventHandler } from './report';
export default (): void => {
const entries: NodeList = document.querySelectorAll('.inbox-entry:not(.js-initialized)');
entries.forEach((element: HTMLElement) => {
registerEvents([
{type: 'click', target: element.querySelector('[name=ib-report]'), handler: reportEventHandler}
{ type: 'click', target: element.querySelector('[name=ib-report]'), handler: reportEventHandler }
]);
element.classList.add('js-initialized');

View File

@ -1,5 +1,16 @@
const path = require('path')
const { environment } = require('@rails/webpacker')
const coffee = require('./loaders/coffee')
environment.loaders.prepend('coffee', coffee)
environment.config.merge({
resolve: {
alias: {
retrospring: path.resolve(__dirname, '..', '..', 'app/javascript/retrospring'),
utilities: path.resolve(__dirname, '..', '..', 'app/javascript/retrospring/utilities')
}
}
})
module.exports = environment

View File

@ -8,7 +8,9 @@
"moduleResolution": "node",
"baseUrl": ".",
"paths": {
"*": ["node_modules/*", "app/javascript/*"]
"*": ["node_modules/*", "app/javascript/*"],
"retrospring/*": ["app/javascript/retrospring/*"],
"utilities/*": ["app/javascript/retrospring/utilities/*"]
},
"sourceMap": true,
"target": "es5",