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 start from 'retrospring/common';
import initAnswerbox from '../retrospring/features/answerbox/index'; import initAnswerbox from 'retrospring/features/answerbox/index';
import initInbox from '../retrospring/features/inbox/index'; import initInbox from 'retrospring/features/inbox/index';
start(); start();
document.addEventListener('turbolinks:load', initAnswerbox); document.addEventListener('turbolinks:load', initAnswerbox);

View File

@ -1,5 +1,5 @@
import registerEvents from "retrospring/utilities/registerEvents"; import registerEvents from 'utilities/registerEvents';
import {createShareEvent} from "./share"; import { createShareEvent } from './share';
export default (): void => { export default (): void => {
if ('share' in navigator) { 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 { export function createShareEvent(answerbox: HTMLElement): () => void {
return function (): void { return function (): void {

View File

@ -1,5 +1,5 @@
import registerEvents from "retrospring/utilities/registerEvents"; import registerEvents from 'utilities/registerEvents';
import {reportEventHandler} from "./report"; import { reportEventHandler } from './report';
export default (): void => { export default (): void => {
const entries: NodeList = document.querySelectorAll('.inbox-entry:not(.js-initialized)'); const entries: NodeList = document.querySelectorAll('.inbox-entry:not(.js-initialized)');

View File

@ -1,5 +1,16 @@
const path = require('path')
const { environment } = require('@rails/webpacker') const { environment } = require('@rails/webpacker')
const coffee = require('./loaders/coffee') const coffee = require('./loaders/coffee')
environment.loaders.prepend('coffee', 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 module.exports = environment

View File

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