Giter Site home page Giter Site logo

Comments (5)

jcready avatar jcready commented on June 14, 2024

Can you provide more details for how to reproduce this issue (protoc args, tsconfig, etc.)? As far as I know name clashes with global/reserved identifiers is already taken care of and it's totally valid to have an export like: export const Object = new Object$Type(); and import it in other files

import { MessageType } from '@protobuf-ts/runtime';
import { Object } from '../example';

console.log('Object instanceof MessageType', Object instanceof MessageType);
console.log(Object.create());

from protobuf-ts.

larscliff avatar larscliff commented on June 14, 2024

@jcready Thank you for your reply. I have this issue in my old project which is quite complex. I will try to create a small demo and let you know.

from protobuf-ts.

jcready avatar jcready commented on June 14, 2024

Also, if you could show what the "View compiled" (at the bottom of your screenshot) shows that would also help. FWIW it seems like the reported error message shown isn't lining up correctly (e.g. imperfect sourcemap mapping) based on the fact that the line shown doesn't use a runtime Object identifier at all.

from protobuf-ts.

larscliff avatar larscliff commented on June 14, 2024

I was able to reproduce the issue. You can find the application code here:
https://github.com/larscliff/protobuf-ts-object-issue

image

image

So far, I've found two ways to work around the problem. Either update the React version to 18 or remove ">0.2%" from the development section in package.json.

I don't know, perhaps there's a better solution?

from protobuf-ts.

jcready avatar jcready commented on June 14, 2024

Yeah, it looks like a bug with webpack where it seems to incorrectly assume that the in-scope Object identifier will always be referencing the global Object class when that isn't the case.

It looks like you might be able to adjust the webpack config to disable the Object(...) wrapping which is the source of the issue: webpack/webpack#5600 (comment)

from protobuf-ts.

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.