Comments (5)
Extension type .mjs is very important to emphasize a JS file is to be loaded as a module.
On the Web, extensions are meaningless and PyScript supports only ESM as so does the web. Any import .js
works without issues and some outdated server might never understand .mjs
extension, so that if the mime-type is not text/javascript
or application/javascript
that file cannot be imported by browsers, no matter the extension name.
In NodeJS there are many ways to enforce modules as ESM, adding "type": "module"
would already handle all .js
files as ESM. The CJS has no meaning on the Web and if you use your own version of require
that will work as those files will be evaluated as plain text, which is desired, while as modules these should fail, as the two module systems are not interchangeable.
All that being said, I believe the service should support .mjs
seamlessly as that's currently a standard mime-type for modern server so it should be understood as such. However, this project is about the PyScript library itself, the Web / service exists as different project so I am pinging @FabioRosado here as he would know best what needs to be done and where (which is not in this repository).
Thanks for your patience and for filing the issue, I hope the .mjs
part at least can be resolved soon.
from pyscript.
Hello and thank you @WebReflection for pinging me, this should be a one line fix, will implement today and then we will have to deploy 😄
from pyscript.
Add both ".mjs" & ".cjs" as well.
Maybe also TypeScript extensions such as ".jsx", ".tsx", ".ts", ".mts", ".cts".
from pyscript.
Add both ".mjs" & ".cjs" as well.
Maybe also TypeScript extensions such as ".jsx", ".tsx", ".ts", ".mts", ".cts".
one thing is to fix standards, one thing is to enable all possible variants that are not standard. I don't think you ever need those extensions to behave differently from plain/text
but until those extensions are not part of standards, it's counter-productive to enable these in any way as we're just moving the issue we have here to the next live service where none of those extensions would return a meaningful mime-type neither.
.mjs
has a standard mime-type defined by all standard bodies, everything else is not there yet and nobody should push for it, imho, if not behind standard processes.
from pyscript.
Closing as there's nothing to do for us in this specific repository.
from pyscript.
Related Issues (20)
- `PyDom[key: int]` raises `AttributeError: 'int' object has no attribute 'indices'`
- Terminal does not show error message when using workers HOT 2
- Py Terminal issues aggregation HOT 1
- PyScript pre-resolved config URL is not consistent
- the py-editor is created repeatedly HOT 13
- MicroPython doesn't support MethodType() from "types" module! HOT 1
- MicroPython doesn't support alternative syntax to create a tuple outta comprehension HOT 1
- MicroPython should provide better error messages for missing APIs HOT 8
- Alert box issue. HOT 3
- Error message not shown. HOT 6
- terminal with worker not working HOT 2
- Saved Image not Displayed. HOT 4
- Incorrect line number in exception tracebacks HOT 18
- UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' when using pyscript 2024.1.3 HOT 15
- nltk data download error HOT 1
- Unable to upload pdf file. HOT 1
- Unable to upload .mp4 file. HOT 1
- Cannot create a PyWorker from python using Pyodide HOT 8
- Improve either PyWorker documentation or internals in general HOT 11
- Trouble interacting with files in Pyscript (both virtual and local) 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 pyscript.