Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion template/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
"preact-jsx-chai": "^3.0.0",
"preact-markup": "^2.0.0",
"preact-render-to-string": "^5.1.4",
"preact-router": "^3.2.1"
"preact-router": "^3.2.1",
"tsconfig-paths-webpack-plugin": "^3.2.0"
},
"devDependencies": {
"@types/jest": "^25.1.2",
Expand Down
16 changes: 16 additions & 0 deletions template/preact.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { resolve } from "path";
import { TsconfigPathsPlugin } from 'tsconfig-paths-webpack-plugin'

export default {
/**
Expand All @@ -24,6 +25,21 @@ export default {
});
});

// Add TsconfigPathsPlugin for webpack
// This allows webpack to resolve your imports whose location depends
// on the `baseUrl` and `paths` fields of your `tsconfig.json`
// https://github.com/dividab/tsconfig-paths-webpack-plugin#tsconfig-paths-webpack-plugin
config.resolve.plugins = [
...(config.resolve.plugins || []),
new TsconfigPathsPlugin({
// We use `config.resolve.extensions` to load the same extensions
// as webpack already does. If you are to edit this property,
// do it before this call if you want TsconfigPathsPlugin
// to beneficiate from it
extensions: config.resolve.extensions
})
]

// Use any `index` file, not just index.js
config.resolve.alias["preact-cli-entrypoint"] = resolve(
process.cwd(),
Expand Down