Comments (5)
I've just run into a similar issue as well. Seems to be caused here:
backpack/packages/backpack-core/config/webpack.config.js
Lines 121 to 128 in cf489d6
Looks like the require.resolve('source-map-support/register')
is resolved as an absolute path which is breaking when I try to copy the prebuilt bundle into my docker container.
from backpack.
Hi,
thanks for figuring out the problem source. If you need a quick solution for this, you can follow the solution in this post: #42 (comment)
It would be better to fix this issue directly, but if you adjust the backpack.config.js as described in that post and add the dependency to source-map-support manually, there should be no problems with the dependency and you should still be able to get proper source maps.
from backpack.
Thanks for the link. Ended up doing something similar, but kept the plugin. I was using yarn workspace <workspace name> run build
which starts a process in the workspace's directory so I just overwrote the lerna logic. This is what I ended up adding to my backpack.config.js:
// Quick fix for source-map-support path resolution
if (config.plugins[1] && config.plugins[1].options && config.plugins[1].options.banner){
config.plugins[1] = new webpack.BannerPlugin({
raw: true,
entryOnly: false,
banner: "require('source-map-support/register');",
})
}
from backpack.
Hi,
I tested your code in my small test project and it worked! Thanks a lot. This solution is better than the other one as I do not need to add source-map-support dependency manually.
Meanwhile I also had a look into the source code and was thinking about how to fix this problem. As mentioned above, aside from the absolute path I also had a problem with missing backslashes. I think there must be an escaping problem somewhere, but I did not figure out where the actual problem occurs as the path itself is built correctly (apart from the fact that it is an absolute one),
Anyway, maybe the problem could be solved by changing the code as depicted in the following:
banner: `require('${
// Is source-map-support installed as project dependency, or linked?
require.resolve('source-map-support').indexOf(process.cwd()) === 0
? // If it's resolvable from the project root, it's a project dependency.
'source-map-support/register'
: // It's not under the project, it's linked via lerna.
path.isAbsolute(require.resolve('source-map-support/register'))
?
process.platform === 'win32'
?
path.relative(config.buildPath, require.resolve('source-map-support/register')).replace(/\\/g,`/`)
:
path.relative(config.buildPath, require.resolve('source-map-support/register'))
:
process.platform === 'win32'
?
require.resolve('source-map-support/register').replace(/\\/g,`/`)
:
require.resolve('source-map-support/register')
}');
It looks a bit ugly, but this code works for me and should not break anything as on non-Windows OS no backslashes will be replaced. Furthermore, relative paths will only be built if they are absolute ones.
I think I will make a pull request the next days. Will in this context also try to clean up the code a bit.
from backpack.
Glad I could help! I tried something similar with path.relative
but was still having issues with it on macOS. I was also thinking about making a PR, but I'm still in the process of learning Lerna so I'm not positive if it'll break things on that front.
from backpack.
Related Issues (20)
- [help] transpiling code from node_modules HOT 4
- Doesn't work with the latest version of Next.js HOT 2
- When release a new version to npm?
- Should config.resolve.modules be undefined when overriding backpack? HOT 3
- v0.8.0 Incompatible HOT 5
- Not work in node 10 HOT 1
- Update dependency around event-stream HOT 4
- Question regarding using it for monorepo
- Jest example not working HOT 3
- Live reload doesn't work inside docker HOT 2
- Specifying files and folders to ignore from watching
- await errors on Express route
- 不支持导出 HOT 1
- Documention on how to change environment. HOT 1
- How do I alias my project root directory to tilde (~)? HOT 13
- Any idea why I need a babel.config.js file and a .babelrc? HOT 1
- Add out of the box TypeScript support with @babel/preset-typescript HOT 2
- How to debug this project? HOT 3
- Backpack artifacts `source-map-support/register` not found in docker container HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from backpack.