formio / ngFormio

JSON powered form rendering library for AngularJS + Form.io.
http://formio.github.io/ngFormio/
MIT License
99 stars 102 forks source link

[BUG] Issue loading ngFormio through webpack #675

Closed arkzero closed 7 months ago

arkzero commented 4 years ago

Environment

Currently attempting to load ngFormio with webpack and running into some issues. Using Babel and Webpack to bundle and transpile all of our project files currently.

Steps to Reproduce

  1. Include reference to formioJS in webpack.ProvidePlugin
  2. Bundle formiojs(first) and ngFormio(second) through webpack
  3. Receive Error Uncaught Error: Cannot find module "Formio"

Expected behavior

Library to load successfully

Observed behavior

Webpack bundling produces the above error, comes from require("Formio"), I've noticed require('formiojs') works and at this point there is a global Formio object available on the window. Looked into using the full and complete versions, but they are not included on most recent build.

Example

If possible, please provide a screenshot, live example (via JSFiddle or similar), and/or example code to help demonstrate the issue.

For code or form JSON, please enclose in a code block:

// In webpack.config.js 
new webpack.ProvidePlugin({
   ...
    Formio: 'formiojs',
  })

// Where we load other vendor libraries:

require('formiojs');
require('ng-formio');
mathielen commented 3 years ago

This is still a valid problem on AngularJS 1.8.2 and ng-formio 4.17.1 :(

travist commented 3 years ago

We load this library using webpack in our portal application so I know it works. Here is how we are importing it.

import 'ng-formio/lib/module';
import 'ng-formio/lib/filters';
import 'ng-formio/lib/providers';
import 'ng-formio/lib/directives';
import 'ng-formio/lib/factories';

Maybe the index is messed up then?

daneformio commented 7 months ago

Closing this thread as it is outdated. Please re-open if it is still relevant. Thank you for your contribution!