Need a special offer?Find out if your project fits.
+

Npm package has missing "main" field

Answered
Andris asked on May 11, 2018

Hello
We wanted to integrate Flexmonster in our build system, using webpack and standard installation using npm/yarn. 
As Flexmonster's package.json does not have "main" field (which should be "flexmonster.js"), it is not possible to use it in tests run by node as imports are not working.
Also it is not possible to build it using webpack for the same reason, although we found a way around it (by using alias and exports-loader to mock module export).
 
Thanks,
Andris
 
 
 

4 answers

Public
Tanya Gryshko Tanya Gryshko Flexmonster May 11, 2018

Hello, Andris,
Thank you for your question!
We have released Flexmonster as an npm package only a week ago, so it is not fully configured yet. Our dev team is going to further improve our npm package for wider usage and kindly ask you to use a workaround for now. We will inform you as soon as we have a better approach.
Please let us know if you have any other questions.
Regards,
Tanya

Public
Tanya Gryshko Tanya Gryshko Flexmonster May 17, 2018

Hello, Andris,
We have published a patch for NPM package (flexmonster@2.5.2-2) that simplifies the usage with Webpack and ES6/CommonJS modules.
Here is the link to our GitHub sample showing how Flexmonster is integrated with Webpack: https://github.com/flexmonster/pivot-webpack
Here you can see that Flexmonster JS and CSS are included in index.js (via import/require). In webpack.config.js we have used standard CSS and fonts loading.
We suggest you try this new version.
Our team would be grateful for any feedback.
Regards,
Tanya

Public
Andris May 17, 2018

Thank you very much, this is what we needed.
Alse the module export was an issue and it is fixed as well 🙂

Public
Tanya Gryshko Tanya Gryshko Flexmonster May 17, 2018

Andris,
We’re glad to hear that!
Thanks for letting us know.
Regards,
Tanya

Please login or Register to Submit Answer