diff --git a/site/docs/errors.md b/site/docs/errors.md index 4153b5a6..77c79431 100644 --- a/site/docs/errors.md +++ b/site/docs/errors.md @@ -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. diff --git a/site/docs/guides/using-preconstruct-dev-in-a-monorepo.md b/site/docs/guides/using-preconstruct-dev-in-a-monorepo.md index e1222100..c86de480 100644 --- a/site/docs/guides/using-preconstruct-dev-in-a-monorepo.md +++ b/site/docs/guides/using-preconstruct-dev-in-a-monorepo.md @@ -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. diff --git a/site/docs/tutorials/index.md b/site/docs/tutorials/index.md index b8494528..927abb0c 100644 --- a/site/docs/tutorials/index.md +++ b/site/docs/tutorials/index.md @@ -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" } } ``` diff --git a/site/docs/tutorials/monorepo.md b/site/docs/tutorials/monorepo.md index b70455cc..6a75c815 100644 --- a/site/docs/tutorials/monorepo.md +++ b/site/docs/tutorials/monorepo.md @@ -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.