Comments (15)
This really shows how much we need https://youtrack.jetbrains.com/issue/KT-47038.
This type of issue would be entirely avoidable.
from kotlinx-io.
@joffrey-bion, right. The plan is to phase it out from core module in subsequent releases.
from kotlinx-io.
@whyoleg it works, thanks! I'll incorporate the fix.
from kotlinx-io.
I'll investigate it further, but for now, it seems like warnings don't cause actual problems in runtime.
from kotlinx-io.
@StefanOltmann v0.3.2 should be deployed to the central repository within an hour.
However, error messages will remain. #283 only solved an issue (introduced in #256) with an actual error being raised a prevented execution within a browser when kotlinx-io
was imported.
from kotlinx-io.
By the way, why isn't the filesystem-related functionality part of another module (not kotlinx-io-core
) that doesn't have the browser among its targets? This would avoid "lying" on the supported platforms, and solve some of those issues, right?
from kotlinx-io.
I'll check if it could be fixed on the library side
I might have a solution here: instead of js("require(\"path\")")
use js("eval('require')('path')")
.
I'm sure that it works (at least with latest Kotlin versions) for both js and wasm, browser and node without any warnings/errors at my side in cryptography-kotlin (js and wasm), but I'm not sure, how it affects some optimisations, but at least it doesn't spam users with unrelated to them warnings
from kotlinx-io.
Is there any workaround for this?
from kotlinx-io.
I just realized #256 was not released yet. I'm using 0.3.1 and I'm experiencing these errors already. So I'm not sure they are caused by the change you mention @fzhinkin
from kotlinx-io.
@joffrey-bion I checked it with 0.3.1 and got error messages, but the code using the library worked fine (modulo UnsupportedOperationExcepion
on an attempt to use a filesystem). Could you please elaborate on what kind of error you're facing?
from kotlinx-io.
For now I just noticed the webpack errors during the build (the ones mentioned in your original post). I haven't pin-pointed any runtime error, but since my build is not 100% working I am trying to get rid of every warning/error that looks fishy. If you say it's not cause for trouble, then I'm ok to wait until a new version of kotlinx-io
fixes this 😉
from kotlinx-io.
Nice this got fixed.
@fzhinkin When can we expect an v0.3.2 release with this fix?
I just released introduced JS support in Ashampoo Kim v0.16, but got a report of error messages.
I have kotlinx-io in my commonMain and it does not produce error messages for wasmJS: https://github.com/Ashampoo/kim/blob/main/src/commonMain/kotlin/com/ashampoo/kim/common/KotlinIoExtensions.kt
from kotlinx-io.
@fzhinkin Thanks for the quick release.
However, error messages will remain.
I don't fully understand this. That Module not found: Error: Can't resolve 'buffer' in
error message should not appear if we don't use the Path
in an browser environment, right? Only if we actually try to use it.
from kotlinx-io.
@StefanOltmann, these warnings are produced by the webpack which bundles sources, not by the app itself.
I'll check if it could be fixed on the library side, but for your app, you can place a webpack config file into <projectRootDir>/webpack.conf.d/config.js
:
config.module.rules.push({
'resolve': {
fallback: {
path: false,
os: false,
buffer: false,
fs: false
}
}
})
Such a config will instruct weback to abandon any attempts to import aforementioned modules.
You can find more info about weback configuration for K/JS here: https://kotlinlang.org/docs/js-project-setup.html#webpack-configuration-file
from kotlinx-io.
Thank you.
For now I just move kotlinx-io extensions out of commonMain, so they are not supported on wasmJS
& js
targets.
My library does not need kotlinx-io to work, it's just there for convenience so users can read image metadata from a kotlinx-io Path
instead of having to get the ByteArray
first.
from kotlinx-io.
Related Issues (20)
- Add support for writing other primitive arrays to Buffers HOT 2
- [help] How to read and write a file? HOT 4
- Add a way to check if Path points to a link HOT 2
- `readFromHead`/`writeToTail` should propagate the `Int` returned from the lambda HOT 2
- Lambda-accepting `UnsafeBufferOperations` need contracts for calls-in-place
- Rename `RealSource` and `RealSink` to `BufferedSource` and `BufferedSink` HOT 2
- Should `Source.buffer` be `@UnsafeIoApi` instead of `@InternalIoApi`? HOT 3
- Evaluate use of unsigned numbers for public API HOT 9
- Add support for atomic file creation
- Move smoke pre-release tests to kotlinx-io repo
- Provide Sink/Source implementations writing to stdout/reading from stdin HOT 11
- Use ByteArray.set<Type>At and get<Type>At to read/write from Segments on Native
- Tidy up samples to make them more kotlin-playground-friendly HOT 2
- FileSystem: missing a function to construct an absolute path from a relative one HOT 2
- FS: On Windows, use Win32 API accepting wide string to avoid issues with the file path encoding
- ByteString: provide ByteString-factory overload accepting unsigned bytes
- Temporary file creation support HOT 7
- Can you use peek to fill the buffer? HOT 2
- Add thread-safety comments to kdoc
- Web crash `get_os().platform() == 'win32'` HOT 2
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 kotlinx-io.