Getting "does not contain a default export" for various libs with yarn workspaces (question)
See original GitHub issueFirst of all, this is a really weird issue and I don’t understand how craco is related to it.
I have followed this tutorial “Using Create-React-App In A Monorepo”.
My goal and config is just made to transpile code from another package.
The moment I launch apps with craco, I am getting does not contain a default export
for a few libraries, but if they are launched with react-scripts, it does not happen. I really don’t understand how that can be related, so I am investigating.
Is there something that craco changes regarding imports or some known issues with lerna/yarn/workspaces?
const path = require('path')
const { getLoader, loaderByName } = require('@craco/craco')
const absolutePath = path.join(__dirname, '../ui-framework')
module.exports = {
webpack: {
alias: {},
plugins: [],
configure: (webpackConfig, { env, paths }) => {
const { isFound, match } = getLoader(webpackConfig, loaderByName('babel-loader'))
if (isFound) {
const include = Array.isArray(match.loader.include)
? match.loader.include
: [match.loader.include]
match.loader.include = include.concat[absolutePath]
}
return webpackConfig
}
}
}
Issue Analytics
- State:
- Created 3 years ago
- Comments:5
Top Results From Across the Web
lock file per workspace · Issue #5428 · yarnpkg/yarn - GitHub
I want to use yarn workspaces to manage a monorepo that includes both apps (top level node modules) and libraries. But having only...
Read more >nohoist in Workspaces | Yarn Blog
There are indeed many ways library owners can address these issues, such as multi-root, custom module map, clever traversing scheme, among ...
Read more >Resolving TypeScript dependencies in yarn workspaces
1 Answer 1 · 1. Maybe "main" in the package. · @Mogarrr You cannot specify a directory for main , but you could...
Read more >Yarn Workspaces Example - ReScript Forum
Might be that your external binding to a default export might be wrong, depending on if you are using commonjs or ES6 import...
Read more >jsconfig.json Reference - Visual Studio Code
If no include attribute is present, then this defaults to including all files in the containing directory and subdirectories. When a include attribute...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@Bluefitdev Here is the current config:
Note that I also had to find a work-around for
tsconfig.json
by extending another config so that CRA can’t overwrite it.tsconfig.json
tsconfig.base.json of one app (package)
@AoDev can you please tell me how did you make it work? What config did you end up using? My current working CRA gives me weird error after i moved it to lerna monorepo style with yarn workspace…