formio / ngFormio

JSON powered form rendering library for AngularJS + Form.io.

Home Page:http://formio.github.io/ngFormio/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BUG] Issue loading ngFormio through webpack

arkzero opened this issue · comments

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.

  • Hosting type
    • Form.io
    • Local deployment
      • Version:
  • Formio.js version: v4.9.10 (latest stable)
  • Frontend framework: Angular v1.7.x
  • Browser: Chrome
  • Browser version: 80.0.3987.149 (Official Build)

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');

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

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?

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