Skip to content

Commit

Permalink
fix: replace removing the addTrailingSlash with removeTrailingSlash a…
Browse files Browse the repository at this point in the history
…nd deleted installOptions.alias options (#1432)

* fix: replace removing the addTrailingSlash with removeTrailingSlash.

* docs: deleted installOptions.alias options

* docs: deleted installOptions.alias
  • Loading branch information
iam-frankqiu authored Oct 29, 2020
1 parent c4c6bf5 commit aab2f8d
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 6 deletions.
2 changes: 0 additions & 2 deletions docs/08-guides.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,10 @@ You can import and use Preact without any custom configuration needed.
```js
// Example: Lets you import "react" in your application, but uses preact internally
// snowpack.config.json
"installOptions": {
"alias": {
"react": "preact/compat",
"react-dom": "preact/compat"
}
}
```

### Vue
Expand Down
3 changes: 0 additions & 3 deletions docs/10-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,6 @@ Options:
- Treeshake your dependencies to optimize your installed files. Snowpack will scan your application to detect which exact imports are used from each package, and then will remove any unused imports from the final install via dead-code elimination (aka tree shaking).
- **`installOptions.installTypes`** | `boolean`
- Install TypeScript type declarations with your packages. Requires changes to your [tsconfig.json](#typescript) to pick up these types.
- **`installOptions.alias`** | `{[mapFromPackageName: string]: string}`
- Alias an installed package name. This applies to imports within your application and within your installed dependency graph.
- Example: `"alias": {"react": "preact/compat", "react-dom": "preact/compat"}`
- **`installOptions.namedExports`** | `string[]`
- _NOTE(v2.13.0): Snowpack now automatically supports named exports for most Common.js packages. This configuration remains for any package that Snowpack can't handle automatically. In most cases, this should no longer be needed._
- Import CJS packages using named exports (Example: `import {useTable} from 'react-table'`).
Expand Down
2 changes: 1 addition & 1 deletion snowpack/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ function normalizeAlias(config: SnowpackConfig, cwd: string, createMountAlias: b
replacement.startsWith('/')
) {
delete cleanAlias[target];
cleanAlias[target] = addTrailingSlash(path.resolve(cwd, replacement));
cleanAlias[removeTrailingSlash(target)] = addTrailingSlash(path.resolve(cwd, replacement));
}
}
return cleanAlias;
Expand Down

1 comment on commit aab2f8d

@vercel
Copy link

@vercel vercel bot commented on aab2f8d Oct 29, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.