HubSpot / vex

A modern dialog library which is highly configurable and easy to style. #hubspot-open-source
http://github.hubspot.com/vex/docs/welcome
MIT License
6.92k stars 493 forks source link

Can't resolve 'vex-js/js/vex.dialog' #232

Closed kaihendry closed 7 years ago

kaihendry commented 7 years ago

I am trying to get code using vex-js to work after an update which includes webpack et al.

Code not written by myself looks like: import dialog from "vex-js/js/vex.dialog"

Which results in a Module not found: Error: Can't resolve 'vex-js/js/vex.dialog'

In the webpack.config.js there is a:

        resolve: {
                alias: {
                        vex: 'vex-js',
                },
        },

Which I could swear used to work.

Has the way using vex-js changed?

kaihendry commented 7 years ago

Having good luck with:

-import dialog from "vex-js/js/vex.dialog"
+import dialog from "vex-dialog"

Furthermore I have these imports that seem to be failing:

static-website$ grep vex assets/styles/client.css
@import "./../../node_modules/vex-js/css/vex.css";
@import "./../../node_modules/vex-js/css/vex-theme-plain.css";
@import "./vex.css";

Any ideas how to best import CSS in a Webpack build?

bbatliner commented 7 years ago

What version of vex are you using? In versions 3.0.0 and up, the main files are located at: vex-js/dist and then in css and js folders.

kaihendry commented 7 years ago

In my package.json I've got "vex-js": "^4.0.0", but previously I think it was a pretty ancient version.

bbatliner commented 7 years ago

I would change the imports/resolves (not familiar with Webpack terminology, sorry) to point to the new file locations. Let me know if that works.

bbatliner commented 7 years ago

Did that work?