GithubHelp home page GithubHelp logo

Comments (5)

danice avatar danice commented on July 26, 2024

Hello,
Materialize-docs is an example of using materialize from a vite project. Can you provide an example project to test this issue?

Thanks!

from materialize.

axelf avatar axelf commented on July 26, 2024

@danice i made i git repository: https://github.com/axelf/materialize-vite
You can downlaod the code and after a npm install and npm run dev you see the error:
Bildschirmfoto 2024-02-20 um 21 03 14

from materialize.

axelf avatar axelf commented on July 26, 2024

This is working: import { M } from "@materializecss/materialize/dist/js/materialize.js";
This is the path of the main entry of the package json.
But why isimport { M } from "@materializecss/materialize"; not working?

It is working, but this says the editor if i hover over the import statement:

Could not find a declaration file for module '@materializecss/materialize/dist/js/materialize.js'. '/myproject/node_modules/@materializecss/materialize/dist/js/materialize.js' implicitly has an 'any' type. If the '@materializecss/materialize' package actually exposes this module, try adding a new declaration (.d.ts) file containing declare module '@materializecss/materialize/dist/js/materialize.js';ts(7016) module "/myproject/node_modules/@materializecss/materialize/dist/js/materialize"

from materialize.

danice avatar danice commented on July 26, 2024

it's because the package has also this entry that takes preference in the import:
"module": "src/index.ts",

This "module" was not causing problems when importing the library using webpack and it make it work when using it as a workspace (as in materialize-docs).

I think we should replace "src/index.ts" here by the ".d.ts" that your comment says. But we should check that it keeps the library working when used from webpack and as a workspace.

from materialize.

axelf avatar axelf commented on July 26, 2024

@danice thank you for helping me out.

For now should i leave the import as it is import { M } from "@materializecss/materialize/dist/js/materialize.js and ignore the error in my code editor? I don't mind the marking in the editor and it works like this for now

from materialize.

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.