-
Notifications
You must be signed in to change notification settings - Fork 148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't resolve worker threads #223
Comments
Hi @mpaccione, |
I was able to solve it in my bundle with browserify, ignoring the reference using |
I have found a workaround, and apparently it works also with browserify without adding any ignore parameter and of course still functional for the browser use. Editing the /// instead of var e = {}, assign e to eval
function(_f){"use strict";var e=eval;...
///then... use the e to eval the require first
try{e("require('worker_threads')").Worker} This thread game me the clue, but specially this tweet I'm uploading this change now, but it won't be yet at the published module version in npm until v2.2.2 |
Hi JS, Thanks for such a quick response on this. I'm unsure whether or not the warning prevents the code from executing because the build still compiles. I will say that using Webpack I seriously cannot run this npm package as an ES6 module import. I had specifically moved away from browserify to webpack and I do not plan to go back after putting the time in already. Overall I'm not a fan of commonJS modules. Anyways, I want you to know that in my webpack configuration all the other modules work. The official Three js and Mapbox modules work. Threebox definitely absolutely is a no go on my import. My backup plan is to include it in the .html file but...fwiw it may be something to check into. I'm not a webpack expert but since my other modules check out... import { Threebox } from "threebox-plugin/dist/threebox.js"; import { Threebox } from "threebox-plugin"; |
@mpaccione that's up to you, I'm not pretending you to use Threebox! But just to clarify, the issue is not in Threebox, it's in
I was about to report the issue to threejs, but I think it doesn't deserve the time as I have already solved it here, and you decide not to use threebox, which is perfectly fine! Closing this issue then! |
Minor version by [@jscastro76](https://github.com/jscastro76), some enhancements and bugs. **WARNING**: This version updates to Mapbox **2.2.0**. Despite v1.11.1 still supported, if used, some features from mapbox v.2.0.1 won't be obviously available such as sky layers. **Known issue**: `BuildingShadow` wont work as the definition of the layers has changed. #### ✨ Enhancements Add a better light for night on 14-buildingshadow.html example #118 - #146 Update to Mapbox 2.2 - #225 Mapbox 2.2: Update Depth calculation keeping compatibility with previous versions - #226 Mapbox 2.2: Update all the examples (14-buildingshadow & 17-azuremaps not updated) - #232 Mapbox 2.2: Add sky layer as an option in threebox - Updated example [07-alignmentTest.html](https://github.com/jscastro76/threebox/blob/master/examples/07-alignmentTest.html) - Updated example [12-add3dmodel.html](https://github.com/jscastro76/threebox/blob/master/examples/12-add3dmodel.html) - Updated example [13-eiffel.html](https://github.com/jscastro76/threebox/blob/master/examples/13-eiffel.html) - #224 Ignore worker_threads - #229 tb.dispose() in dev mode not working. It was removed from three.js but not included in migration guide. - #234 Update all the examples to include antialias: true in the webglcontext #### 🪲 Bug fixes - #223 Can't resolve worker threads - #230 Module not found: Can't resolve 'worker_threads' (duplicated #223) #### 📝 Documentation - Updated [documentation](/examples/readme.md) (Added a note on the examples updated to Mapbox 2.2.0) - Updated [Threebox documentation](/docs/Threebox.md) (public cdns data, `sky` attribute and property, `tb.createSkyLayer`, `tb.getSunSky`, `tb.updateSunSky`, `tb.updateLightHelper`, ) - Updated [Examples](/examples) documentation (new sky layers in 7, 12, 13).
@mpaccione this is already uploaded to v.2.2.2 version of the npm module if you want to use it |
@jscastro76 Nice work on the worker_threads fix. Now in 2.2.2 it is no problem. Thank you kindly and looking forward to learning more about Threebox. Unfortunately it still returns undefined at the import from the docs directory... I had also tried import { Threebox } from "threebox-plugin" which returns and is not undefined. However then Three is missing. I had tried importing three separately but it didn't work to load the basic doc example. |
Not sure what's the issue you're facing, the module is imported properly in ten other projects. you have also an example in vue.js that uses threebox as a module. Regarding THREE, is bundled in Threebox, so it should be accessible using import {THREE} from "threebox-plugin" or import {THREE} from "threebox-plugin/dist/threebox.js" Hope it helps |
Hello, I am using Webpack on clientside. I have no issues with my other packages.
I am receiving this error.
Working with my public repo here:
https://github.com/mpaccione/everest_flight_sim/tree/debugger-mapbox-tiles
in /client dir
npm install
edit dirname path in webpack.config.js
npm run build
Any thoughts on the issue? Also, unless I import Three myself I get this error: Error: THREE is not defined
at eval (mapbox-gl.js:30)
The text was updated successfully, but these errors were encountered: