![]() Each of those packages gets its src/ folder transpiled to a consumable dist/.ĭue to the nature of yarn workspaces, all workspace packages are symlinked into the project root's node_modules folder, and thus available to all other workspace packages. One workspace package is an app built with electron-webpack.Īnother package is an app built with create-react-app.Īny number of additional packages (utils, modules, anything) exist in the workspace, and they are watched and transpiled by some tool (e.g. The scenario is a project using yarn workspaces and multiple apps sharing multiple modules. Return configureYarnWorkspaces(config, workspaceRoot, "lib") Import Button from libAlias // in webpack config: Return configureYarnWorkspaces(config, workspaceRoot) When you provide a libAlias: 'lib' option, you can omit the aliased part from the import path: If your packages transpile to their lib folders, you would normally have to type out that path when importing their modules. relative path inside packages to include in alias target (optional) } Arguments configureYarnWorkspaces(config:object, root:string, libAlias?:string):object config packages/electron-app/Ĭonst configureYarnWorkspaces = require("electron-webpack-config-yarn-workspaces")Ĭonst workspaceRoot = path.resolve(_dirname, "./.")Ĭonfig = configureYarnWorkspaces(config, workspaceRoot) Optionally specify a libAlias (see below). Pass the current configuration object to the function and use the modified return value.Īlways specify the path of the workspace root folder. Config adjustments for yarn workspaces support.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |