Comments (2)
Hi @lowray 👋
So the first error you've reported appears to be a bug with deno bundle
as far as I can see, the outputted, bundled js file appears to have placed the definition of:
request2.get = ...
on line 309, when in fact request2
is only defined later on line 23284. Hence why we get the reference error.
If you have a use-case for Opine in this bundled form then I would recommend raising an issue to report the bug with deno bundle
on the main https://github.com/denoland/deno repo 😄.
...interestingly if you fix the request2
issue by moving the request2.get
method to the appropriate place, then you receive the following error:
error: Uncaught ReferenceError: init is not defined
await init(read("./pkg/denoflate_bg.wasm"));
^
at file:///~/git/asos-craigmorten/opine/opine.js:18261:1
So I sense there may be a few (or perhaps the same?) bugs with the deno bundle
CLI command at the moment. This particular one is regarding a missing init
method which is completely missing from the bundle, indicating that deno bundle
is somehow missing the default export
/ import
of this method within the https://github.com/hazae41/denoflate library which Opine makes use of.
The error you are seeing when not providing the --no-check
is due to deno bundle
stripping all type information from Opine to create your opine.js
file. Without this type information Deno is unable to infer some of the properties on the app
object, nor will it know what types the req
and res
objects have. You would either need to import the Opine types into your file and manually type the various objects, or alternatively, don't use typescript at all by changing your file extension to .js
, i.e. serve.js
- given you are making use of --no-check
which skips typechecking, it may be simpler for you to just use plain JavaScript in the first place!
Ultimately the errors you are seeing are expected behaviour when importing objects and functions from a JS file into a TS file / project.
Given neither of these issues are (afaik) anything wrong with Opine itself I will close this - happy to re-open if something else comes to light!
from opine.
Having a read, I believe this will all be fixed in a next release following the merge of denoland/deno#8901 which upgrades swc which is used for bundling. So probably not worth raising a new issue as likely a duplicate of all the listed ones.
from opine.
Related Issues (20)
- Calling req.body.read() in a post or put method crashes deno HOT 2
- Incompatible with Deno 1.14.0 HOT 4
- Dependency error, no exported member default for several dependencies HOT 1
- Cross-Platform Path Separatores in serveStatic HOT 1
- TS2305 ERROR in deps.ts with range-parser default export HOT 2
- Bug on deno std, or opine ??? HOT 4
- Outdated dependencies
- Some (but not all) static files fail to be served - ERR_CONTENT_LENGTH_MISMATCH HOT 11
- Getting a plain Deno Request object from an OpineRequest? HOT 8
- JSON middleware does not work on Deno Deploy HOT 1
- How to read a request received from a html form? HOT 2
- FormData parser middleware is missing HOT 1
- Deno.Buffer will be deprecated in Deno 2.0 HOT 1
- Type incompatibility with Deno 1.20.1 HOT 5
- Opine can't find template views on Deno Deploy HOT 3
- [QUESTION] how to send ReadableStream<Uint8Array>? HOT 2
- Requested module doesn't provide required data HOT 1
- How to upload file?? HOT 1
- Request protocol for WebSocket upgrade request is always http HOT 2
- server-sent-events with opine 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 opine.