Giter Club home page Giter Club logo

Comments (6)

chuckdumont avatar chuckdumont commented on June 29, 2024

I've never tried to use import to load Dojo modules, but I can't think of any reason why it wouldn't work. My suggestion would be to go ahead and try it. If import doesn't work, CommonJS require should work.

from dojo-webpack-plugin.

kaczordon avatar kaczordon commented on June 29, 2024

So using just require seems to work in bringing the actual object, but none of the methods can be called and result in errors. Same when I try to call them as constructors instead to see if that was the issue. Sample of errors when creating a Dojo dialog:
"dijit/nls/common", error: Error: Module not found
string.js:154 Uncaught Error: string.substitute could not find key "loadingState" in template

With import nothing seems to happen and I just get undefined.

What could this be an issue with?

from dojo-webpack-plugin.

chuckdumont avatar chuckdumont commented on June 29, 2024

Not sure about your issues, but you can check out the react-webpack-babel fork I created. It does just what you're looking for (invokes dojo/dom-style from within a react class.

from dojo-webpack-plugin.

GordonSmith avatar GordonSmith commented on June 29, 2024

Yes it can be done. This is what I do (there may be better ways):

  1. Create a single webpack package which re-exports the bits of dojo I am interested in ("dojo-shim"):
import * as Deferred from "dojo/Deferred";
import * as domConstruct from "dojo/dom-construct";
export {
    Deferred,
    domConstruct
};
  1. In my "React" like environment I install "dojo-shim" into package.json and then import as normal:
import { Deferred } from "dojo-shim";

This works for me as I reuse dojo-shim in several apps.

from dojo-webpack-plugin.

chuckdumont avatar chuckdumont commented on June 29, 2024

Thanks @GordonSmith. Closing this issue now. @kaczordon if you have any more issues/questions, you can reopen.

from dojo-webpack-plugin.

kaczordon avatar kaczordon commented on June 29, 2024

Thank you @chuckdumont and @GordonSmith for the help.

from dojo-webpack-plugin.

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.