Comments (14)
I'm having this issue when I try to run this on Docker. I have a build stage that compiles the build/main.js
bundle and then removes all dev deps and any files that my app doesn't need, then I have another step that simply runs npm start
. In theory that should be enough but into the same issue.
> node ./build/main.js
module.js:550
throw err;
^
Error: Cannot find module 'source-map-support/register'
at Function.Module._resolveFilename (module.js:548:15)
at Function.Module._load (module.js:475:25)
from backpack.
@thierryskoda When I pushed the change in 0.0.9
I had a feeling this would be an issue. The problem is that lerna
doesn't handle the local npm symlink properly without that require.resolve()
, which makes developing backpack really really annoying. We need to figure out a better solution.
As a workaround you should remove webpack.BannerPlugin()
using backpack.config.js
, add source-map-support
as a dependency (npm i source-map-support), and then add import 'source-map-support/register'
to the top of your entry file (src/index.js
or whatever).
// backpack.config.js
module.exports = {
webpack: (config, options) => {
...
config.plugins.splice(1, 1) // remove the BannerPlugin
return config
}
}
//src/index.js or whatever
import 'source-map-support/register'
Do you think it's a best practice to build in production? I though it was much better to build locally than just push the build folder in production.
Nowadays our build servers are the same VMs as our production machines so paths always match. However, I know that is not the case for everyone, especially for people using SaaS CI's and many PaaS providers. When we used to use Heroku with webpack or grunt, we used the postinstall
npm script where we ran our build step.
For example:
{
"scripts": {
...
"build": "backpack build",
"postinstall": "npm run build"
}
}
from backpack.
still is the problem with docker builds as @jalvarado91 said
from backpack.
Are you building somewhere differently than running in prod?
from backpack.
I'm using heroku so I'm doing backpack build
and then pushing the build folder (with .Procfile
and package.json
) to my heroku app.
from backpack.
I have the same issue on Windows 7 64bit Enterprise
yarn start
$ node ./build/main.js
module.js:472
throw err;
^
Error: Cannot find module 'C:codejsproductssfi.sebn.coackendattachment
ode_modulessource-map-supportsource-map-support.js'
at Function.Module._resolveFilename (module.js:470:15)
at Function.Module._load (module.js:418:25)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (C:\code\js\products\sfi.sebn.com\backend\attachment\build\main.js:1:63)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
error Command failed with exit code 1.
console.log(require.resolve('source-map-support'))
// C:\code\js\products\sfi.sebn.com\backend\attachment\node_modules\source-map-support\source-map-support.js
console.log(`require('${require.resolve('source-map-support')}')`)
// require('C:\code\js\products\sfi.sebn.com\backend\attachment\node_modules\source-map-support\source-map-support.js')
package.json extract
"scripts": {
"start": "node ./build/main.js",
"prestart": "backpack build"
}
versions
node: '7.5.0'
yarn: '0.19.1'
backpack-core: '0.0.9'
Locally I changed https://github.com/palmerhq/backpack/blob/master/packages/backpack-core/config/webpack.config.js#L110 to banner: 'require("source-map-support/register")'
as in version 0.0.8 which works as expected but now I'm out of sync with npm version ofc.
from backpack.
Do you think it's a best practice to build in production? I though it was much better to build locally than just push the build folder in production.
from backpack.
I'll work on this!
from backpack.
Okay thanks! I will try that!
from backpack.
thank you @jaredpalmer Using both backpack and razzle on production systems and loving it
from backpack.
Has the issue been resolved
from backpack.
still having the same problem on windows 10 in both development and build.
project uses lerna and yarn workspaces.
using backpack version 0.7.0
from backpack.
@jalvarado91 did you solve that? we facing the same issue building docker image with multi stage
from backpack.
Facing the same issue. The examples provided here did not help. Any news on fixing this?
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
- Incorrect reference to source-map-support/register when using backpack in yarn workspaces HOT 5
- 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.