Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document the need for Developer Mode on Windows #458

Merged
merged 1 commit into from Jul 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions site/docs/errors.md
Expand Up @@ -25,3 +25,7 @@ Preconstruct requires that all entrypoints in a package have the same fields so
## '{export-a}' is not exported by {module-a}, imported by {module-b} {#export-a-is-not-exported-by-module-a-imported-by-module-b}

If you are building a TypeScript package, chances are you're re-exporting a type in a way that's not compatible with `@babel/preset-typescript`. See [Building TypeScript packages](/guides/building-typescript-packages) for more information. To fix it, you should use [type-only imports and exports](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html#type-only-imports-and-export)

## EPERM: operation not permitted, symlink {file.ts} -> {file.js} {#operation-not-permitted-symlink}

If you're on Windows, you need to [enable Developer Mode](/guides/using-preconstruct-dev-in-a-monorepo#windows-developer-mode) for `preconstruct dev` to work on Windows.
10 changes: 10 additions & 0 deletions site/docs/guides/using-preconstruct-dev-in-a-monorepo.md
Expand Up @@ -15,3 +15,13 @@ A common use case in monorepos is that there are some packages which depend on e
Once you add it to your package.json and run `yarn`, Preconstruct creates links from your source files to the appropriate source file. For the CommonJS dist file, Preconstruct creates a file which installs a require hook which compiles the package with Babel so that you can directly require the code in any Node code without having to do anything special to compile the package. For module builds, Preconstruct creates files that re-export the source files, so you have to compile the packages in your bundler. For example, if you're using webpack, you should use babel-loader. Preconstruct also creates files for Flow and TypeScript to resolve to the source files.

> Note: The re-exports for module builds use CommonJS, this is done because ESM cannot re-export an entire module including default exports unless you know what the exports of the module are.

## Windows Developer Mode {#windows-developer-mode}

If you are using Windows and Developer Mode is not enabled, `preconstruct dev` will produce an error like

```text
EPERM: operation not permitted, symlink '...' -> '...'
```

You can enable Developer Mode in the Windows settings app. On Windows 11, this can be done by searching the start menu for "Developer settings" and then enabling the Developer Mode toggle switch.
2 changes: 1 addition & 1 deletion site/docs/tutorials/index.md
Expand Up @@ -57,7 +57,7 @@ $ yarn preconstruct init
"module": "dist/a-random-number.esm.js",
"license": "MIT",
"devDependencies": {
"preconstruct": "^0.0.68"
"@preconstruct/cli": "^2.1.5"
}
}
```
Expand Down
2 changes: 1 addition & 1 deletion site/docs/tutorials/monorepo.md
Expand Up @@ -66,7 +66,7 @@ Preconstruct has asked us some slightly different questions since it's detected

### Setting up `preconstruct dev` {#setting-up-preconstruct-dev}

`preconstruct dev` is a command in Preconstruct that lets you import your packages without having to build them every time you make a change or alias the dist files to source files in another tool like webpack, see the [Using Preconstruct dev in a monorepo guide](/guides/using-preconstruct-dev-in-a-monorepo) for more info.
`preconstruct dev` is a command in Preconstruct that lets you import your packages without having to build them every time you make a change or alias the dist files to source files in another tool like webpack, see the [Using Preconstruct dev in a monorepo guide](/guides/using-preconstruct-dev-in-a-monorepo) for more info. If you are using Windows, you need to enable Developer Mode before using `preconstruct dev` by following the instructions [here](/guides/using-preconstruct-dev-in-a-monorepo#windows-developer-mode).

We're going to add it to a postinstall script so that yarn will run it after packages are installed. Our package.json will now look like this.

Expand Down