Last active
November 2, 2022 06:32
-
-
Save phuctm97/7470a3b981fd80a501b4047e1e99a9f4 to your computer and use it in GitHub Desktop.
Revisions
-
phuctm97 revised this gist
Apr 17, 2020 . No changes.There are no files selected for viewing
-
phuctm97 revised this gist
Apr 17, 2020 . No changes.There are no files selected for viewing
-
phuctm97 revised this gist
Apr 17, 2020 . No changes.There are no files selected for viewing
-
phuctm97 revised this gist
Apr 17, 2020 . 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 @@ -5,7 +5,7 @@ const path = require('path'); * compilerOptions.paths. * * @param {string} tsconfigPath - Path to tsconfig.json (can be either relative or absolute path). * @return {object} An object representing analogous Webpack alias. */ module.exports = (tsconfigPath = './tsconfig.json') => { const tsconfig = require(tsconfigPath); -
phuctm97 revised this gist
Apr 17, 2020 . 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 path = require('path'); * Helper function infers Webpack aliases from tsconfig.json compilerOptions.baseUrl and * compilerOptions.paths. * * @param {string} tsconfigPath - Path to tsconfig.json (can be either relative or absolute path). * @return {object} An object representing corresponding Webpack alias. */ module.exports = (tsconfigPath = './tsconfig.json') => { -
phuctm97 revised this gist
Apr 17, 2020 . No changes.There are no files selected for viewing
-
phuctm97 revised this gist
Apr 17, 2020 . 2 changed files with 2 additions and 2 deletions.There are no files selected for viewing
File renamed without changes.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,8 +1,8 @@ const path = require('path'); const getAlias = require('./get-webpack-alias-from-tsconfig'); module.exports = { resolve: { alias: getAlias(path.resolve(__dirname, 'tsconfig.json')), }, }; -
phuctm97 revised this gist
Apr 12, 2020 . 3 changed files with 6 additions and 5 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,15 +1,16 @@ const path = require('path'); /** * Helper function infers Webpack aliases from tsconfig.json compilerOptions.baseUrl and * compilerOptions.paths. * * @param {string} tsconfigPath - Path to tsconfig.json (Can be either relative or absolute path). * @return {object} An object representing corresponding Webpack alias. */ module.exports = (tsconfigPath = './tsconfig.json') => { const tsconfig = require(tsconfigPath); const { paths, baseUrl } = tsconfig.compilerOptions; return Object.fromEntries(Object.entries(paths) .filter(([, pathValues]) => pathValues.length > 0) .map(([pathKey, pathValues]) => { @@ -18,4 +19,4 @@ module.exports = (tsconfigPath = './tsconfig.json') => { baseUrl, pathValues[0].replace('/*', '')); return [key, value]; })); }; 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 @@ -6,4 +6,4 @@ "@util/*": ["src/util/*"] } } } 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 @@ -5,4 +5,4 @@ module.exports = { resolve: { alias: extractAlias(path.resolve(__dirname, 'tsconfig.json')), }, }; -
phuctm97 revised this gist
Apr 12, 2020 . 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 @@ { "compilerOptions": { "baseUrl": ".", "paths": { "@core/*": ["src/core/*"], "@util/*": ["src/util/*"] } } } -
phuctm97 revised this gist
Apr 12, 2020 . 1 changed file with 8 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,8 @@ const path = require('path'); const extractAlias = require('./extract-webpack-alias-from-tsconfig'); module.exports = { resolve: { alias: extractAlias(path.resolve(__dirname, 'tsconfig.json')), }, }; -
phuctm97 revised this gist
Apr 12, 2020 . 1 changed file with 6 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 @@ -1,5 +1,11 @@ const path = require('path'); /** * Helper function infers Webpack aliases from tsconfig.json compilerOptions.baseUrl and compilerOptions.paths. * * @param {string} tsconfigPath - Path to tsconfig.json (Can be either relative or absolute path). * @return {object} An object representing corresponding Webpack alias. */ module.exports = (tsconfigPath = './tsconfig.json') => { const tsconfig = require(tsconfigPath); const { paths, baseUrl } = tsconfig.compilerOptions; -
phuctm97 revised this gist
Apr 12, 2020 . 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 @@ module.exports = (tsconfigPath = './tsconfig.json') => { const tsconfig = require(tsconfigPath); const { paths, baseUrl } = tsconfig.compilerOptions; return Object.fromEntries(Object.entries(paths) .filter(([, pathValues]) => pathValues.length > 0) .map(([pathKey, pathValues]) => { const key = pathKey.replace('/*', ''); -
phuctm97 revised this gist
Apr 12, 2020 . No changes.There are no files selected for viewing
-
phuctm97 created this gist
Apr 12, 2020 .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,15 @@ const path = require('path'); module.exports = (tsconfigPath = './tsconfig.json') => { const tsconfig = require(tsconfigPath); const { paths, baseUrl } = tsconfig.compilerOptions; Object.fromEntries(Object.entries(paths) .filter(([, pathValues]) => pathValues.length > 0) .map(([pathKey, pathValues]) => { const key = pathKey.replace('/*', ''); const value = path.resolve(path.dirname(tsconfigPath), baseUrl, pathValues[0].replace('/*', '')); return [key, value]; })); }