Skip to content

Commit

Permalink
fix(vite-plugin-angular): add workspaceRoot to plugin options
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonroberts committed Jul 27, 2022
1 parent 63876e5 commit 5b90fbc
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
6 changes: 5 additions & 1 deletion apps/analog-app/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@ export default defineConfig(({ mode }) => {
},
plugins: [
mode !== 'test'
? angular({ mode, tsconfig: './tsconfig.app.json' })
? angular({
mode,
tsconfig: './tsconfig.app.json',
workspaceRoot: process.cwd(),
})
: undefined,
visualizer(),
splitVendorChunkPlugin(),
Expand Down
2 changes: 1 addition & 1 deletion packages/create-analog/template-angular-v14/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
},
"devDependencies": {
"@analogjs/vite-plugin-angular": "latest",
"@angular-devkit/build-angular": "14.0.0",
"@angular-devkit/build-angular": "^14.0.3",
"@angular/cli": "~14.0.3",
"@angular/compiler-cli": "^14.0.0",
"typescript": "~4.7.2",
Expand Down
4 changes: 3 additions & 1 deletion packages/vite-plugin-angular/src/lib/angular-vite-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
interface PluginOptions {
tsconfig: string;
mode: string;
workspaceRoot: string;
}

interface EmitFileResult {
Expand All @@ -31,6 +32,7 @@ export function angular(
pluginOptions: PluginOptions = {
tsconfig: './tsconfig.app.json',
mode: 'development',
workspaceRoot: process.cwd()
}
): Plugin[] {
// The file emitter created during `onStart` that will be used during the build in `onLoad` callbacks for TS files
Expand Down Expand Up @@ -76,7 +78,7 @@ export function angular(
advancedOptimizations: isProd,
},
{
workspaceRoot: `${config.root}`,
workspaceRoot: pluginOptions.workspaceRoot,
sourcemap: !isProd,
optimization: isProd,
}
Expand Down

0 comments on commit 5b90fbc

Please sign in to comment.