Skip to content

Commit

Permalink
resolve alias for core
Browse files Browse the repository at this point in the history
  • Loading branch information
Greegko committed Jul 20, 2021
1 parent 97ce204 commit 1f844f7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
4 changes: 2 additions & 2 deletions packages/core/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@
}
},
"include": [
"public-api.ts",
"public-api.ts"
],
"exclude": [
"node_modules",
"dist"
],
]
}
14 changes: 13 additions & 1 deletion packages/web/config/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
const path = require('path');
const rpgVillageCore = "../../core/";
const tsconfig = require(path.resolve(__dirname, rpgVillageCore, 'tsconfig.json'));

const rpgVillageDist = path.resolve(__dirname, rpgVillageCore, 'dist');

module.exports = {
entry: ["./src/main.tsx"],

Expand All @@ -11,7 +17,13 @@ module.exports = {
devtool: "source-map",

resolve: {
extensions: [".webpack.js", ".web.js", ".js", ".ts", ".tsx"]
extensions: [".webpack.js", ".web.js", ".js", ".ts", ".tsx"],
alias: Object.keys(tsconfig.compilerOptions.paths).reduce((aliases, aliasName) => {
const aliasBase = aliasName.slice(0, -2);
const pathBase = tsconfig.compilerOptions.paths[aliasName][0].slice(0, -2);

return { ...aliases, [aliasBase]: `${rpgVillageDist}/${pathBase}` };
}, {}),
},

module: {
Expand Down

0 comments on commit 1f844f7

Please sign in to comment.