Git Product home page Git Product logo

Comments (15)

lppedd avatar lppedd commented on September 26, 2024 3

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.

fzhinkin avatar fzhinkin commented on September 26, 2024 2

@joffrey-bion, right. The plan is to phase it out from core module in subsequent releases.

from kotlinx-io.

fzhinkin avatar fzhinkin commented on September 26, 2024 2

@whyoleg it works, thanks! I'll incorporate the fix.

from kotlinx-io.

fzhinkin avatar fzhinkin commented on September 26, 2024 1

I'll investigate it further, but for now, it seems like warnings don't cause actual problems in runtime.

from kotlinx-io.

fzhinkin avatar fzhinkin commented on September 26, 2024 1

@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.

joffrey-bion avatar joffrey-bion commented on September 26, 2024 1

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.

whyoleg avatar whyoleg commented on September 26, 2024 1

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.

joffrey-bion avatar joffrey-bion commented on September 26, 2024

Is there any workaround for this?

from kotlinx-io.

joffrey-bion avatar joffrey-bion commented on September 26, 2024

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.

fzhinkin avatar fzhinkin commented on September 26, 2024

@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.

joffrey-bion avatar joffrey-bion commented on September 26, 2024

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.

StefanOltmann avatar StefanOltmann commented on September 26, 2024

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.

StefanOltmann avatar StefanOltmann commented on September 26, 2024

@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.

fzhinkin avatar fzhinkin commented on September 26, 2024

@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.

StefanOltmann avatar StefanOltmann commented on September 26, 2024

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.

Ashampoo/kim@991cd4c

from kotlinx-io.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.