Last active
June 19, 2025 19:38
-
-
Save nerdyman/2f97b24ab826623bff9202750013f99e to your computer and use it in GitHub Desktop.
Revisions
-
nerdyman revised this gist
Oct 4, 2019 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -16,7 +16,7 @@ function resolveTsconfigPathsToAlias({ Object.keys(paths).forEach((item) => { const key = item.replace('/*', ''); const value = resolve(webpackConfigBasePath, paths[item][0].replace('/*', '').replace('*', '')); aliases[key] = value; }); -
nerdyman revised this gist
Oct 3, 2019 . 2 changed files with 4 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -3,13 +3,13 @@ const { resolve } = require('path'); /** * Resolve tsconfig.json paths to Webpack aliases * @param {string} tsconfigPath - Path to tsconfig * @param {string} webpackConfigBasePath - Path from tsconfig to Webpack config to create absolute aliases * @return {object} - Webpack alias config */ function resolveTsconfigPathsToAlias({ tsconfigPath = './tsconfig.json', webpackConfigBasePath = __dirname, } = {}) { const { paths } = require(tsconfigPath).compilerOptions; const aliases = {}; This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -17,6 +17,7 @@ "es2017.object" ], "paths": { "Root/*": ["src/*"], "Components/*": ["src/components/*"], "Data/*": ["src/data/*"], } -
nerdyman revised this gist
Sep 7, 2018 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -4,7 +4,7 @@ const { resolve } = require('path'); * Resolve tsconfig.json paths to Webpack aliases * @param {string} tsconfigPath - Path to tsconfig * @param {string} webpackConfigBasePath - Relative base path from tsconfig to Webpack config to create absolute aliases * @return {object} - Webpack alias config */ function resolveTsconfigPathsToAlias({ tsconfigPath = './tsconfig.json', -
nerdyman revised this gist
Sep 7, 2018 . 3 changed files with 18 additions and 11 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,24 +1,27 @@ const { resolve } = require('path'); /** * Resolve tsconfig.json paths to Webpack aliases * @param {string} tsconfigPath - Path to tsconfig * @param {string} webpackConfigBasePath - Relative base path from tsconfig to Webpack config to create absolute aliases * @return {object} */ function resolveTsconfigPathsToAlias({ tsconfigPath = './tsconfig.json', webpackConfigBasePath = './'} = {}, ) { const { paths } = require(tsconfigPath).compilerOptions; const aliases = {}; Object.keys(paths).forEach((item) => { const key = item.replace('/*', ''); const value = resolve(webpackConfigBasePath, paths[item][0].replace('/*', '')); aliases[key] = value; }); return aliases; } module.exports = resolveTsconfigPathsToAlias; This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,4 @@ { "compilerOptions": { "module": "commonjs", "moduleResolution": "node", This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,9 +1,14 @@ // add paths to webpack const resolveTsconfigPathsToAlias = require('./resolve-tsconfig-path-to-webpack-alias'); module.exports = { // ... resolve: { // ... alias: resolveTsconfigPathsToAlias({ tsconfigPath: '../tsconfig.json', // Using custom path webpackConfigBasePath: '../', // Using custom path }), } } -
nerdyman revised this gist
Apr 25, 2017 . 1 changed file with 3 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -19,4 +19,6 @@ function resolveTsconfigPathsToAlias() { }); return aliases; } module.exports = resolveTsconfigPathsToAlias; -
nerdyman renamed this gist
Apr 25, 2017 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
nerdyman revised this gist
Apr 25, 2017 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ const { resolve } = require('path'); /** * resolveTsConfigPaths - resolve tsconfig paths to webpack aliases -
nerdyman revised this gist
Apr 25, 2017 . 1 changed file with 9 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,9 @@ // add paths to webpack module.exports = { ... resolve: { ... alias: resolveTsconfigPathsToAlias(), } } -
nerdyman renamed this gist
Apr 25, 2017 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
nerdyman renamed this gist
Apr 25, 2017 . 1 changed file with 5 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,15 +1,19 @@ import { resolve } from 'path'; /** * resolveTsConfigPaths - resolve tsconfig paths to webpack aliases * @return {object} */ function resolveTsconfigPathsToAlias() { // @NOTE you may need to change this path depending on your project set up const { paths } = require('../tsconfig.json').compilerOptions; const aliases = {}; Object.keys(paths).forEach((item) => { const key = item.replace('/*', ''); // @NOTE you might need to change './' depending on your project set up const value = resolve('./', paths[item][0].replace('/*', '')); aliases[key] = value; }); -
nerdyman created this gist
Apr 25, 2017 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,24 @@ { ... "compilerOptions": { "module": "commonjs", "moduleResolution": "node", "outDir": "./dist", "allowJs": true, "target": "es6", "jsx": "react", "sourceMap": true, "noImplicitAny": true, "strictNullChecks": true, "baseUrl": "./", "lib": [ "DOM", "ES5", "ES6", "es2017.object" ], "paths": { "Components/*": ["src/components/*"], "Data/*": ["src/data/*"], } }, This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,18 @@ /** * resolveTsConfigPaths - resolve tsconfig paths to webpack aliases * @return {object} */ function resolveTsconfigPathsToAlias() { const { paths } = require('../tsconfig.json').compilerOptions; const aliases = {}; Object.keys(paths).forEach((item) => { const key = item.replace('/*', ''); const value = path.resolve('./', paths[item][0].replace('/*', '')); aliases[key] = value; }); return aliases; } This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1 @@ import Banner from 'Components/banner';