mirror of
https://github.com/mastermindzh/rickvanlieshout.com
synced 2025-07-27 12:42:28 +02:00
refactor(starter): upgrade and move to typescript
This commit is contained in:
25
internal/gatsby/on-create-webpack-config.ts
Normal file
25
internal/gatsby/on-create-webpack-config.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import path from "path";
|
||||
|
||||
import { CreateWebpackConfigArgs } from "gatsby";
|
||||
import { CompilerOptions } from "typescript";
|
||||
|
||||
import { compilerOptions } from "../../tsconfig.json";
|
||||
|
||||
const onCreateWebpackConfig = (
|
||||
(options: Pick<CompilerOptions, "paths">) =>
|
||||
({ actions }: CreateWebpackConfigArgs) => {
|
||||
actions.setWebpackConfig({
|
||||
resolve: {
|
||||
alias: Object.entries(options.paths || []).reduce(
|
||||
(aliases, [name, [target]]) => ({
|
||||
...aliases,
|
||||
[name]: path.resolve(target),
|
||||
}),
|
||||
{},
|
||||
),
|
||||
},
|
||||
});
|
||||
}
|
||||
)(compilerOptions);
|
||||
|
||||
export { onCreateWebpackConfig };
|
Reference in New Issue
Block a user