oroup

Can't resolve fc-utils with webpack

Recommended Posts

I have an app that works great under 3.13.5 but fails to compile under 3.14.0 and 3.14.1. 

I use webpack to compile and get several errors of this form: 

ERROR in ./node_modules/@fusioncharts/widgets/src/chart/_internal/realtime.js
Module not found: Error: Can't resolve '../../../../fc-utils/src/array/safe-max'

Looking in the node_modules directory by hand I notice there is no fc-utils directory but there is a utils directory (which does contain src/array/safe-max.js) and I suspect this is just a naming issue. (And perhaps compiling like this is unusual so nobody else has found it.) 

It's tough to do a full reproduction but relevant parts of various files: 

package.json: 

    "fusioncharts": "^3.14.1",
 

application.js: 

import 'fusioncharts/viz/doughnut2d';
import 'fusioncharts/viz/stackedbar2d';
import 'fusioncharts/themes/es/fusioncharts.theme.fusion';
 

custom.js: 

import FusionCharts from 'fusioncharts/core';
import Doughnut2D from 'fusioncharts/viz/doughnut2d';
import Stackedbar2D from 'fusioncharts/viz/stackedbar2d';
import AngularGauge from 'fusioncharts/viz/angulargauge';
import HLinearGauge from 'fusioncharts/viz/hlineargauge';
import FusionTheme from 'fusioncharts/themes/es/fusioncharts.theme.fusion';

yarn.lock: 

[email protected]:
  version "3.14.1"
  resolved "https://registry.yarnpkg.com/fusioncharts/-/fusioncharts-3.14.1.tgz#328f3bc9b369d9ae553b19926484fe8e22ab3b19"
  integrity sha512-qsQdYFGqtozSpaTdElJmtBg+bmtlaIGj2ULniC4PIwD/kON+sgthCqKPguPLNOBdRM9mITxF2ihR4EvOdoj27Q==
  dependencies:
    "@babel/runtime" "7.4.5"
    "@fusioncharts/charts" "^3.14.1"
    "@fusioncharts/constructor" "^1.0.1"
    "@fusioncharts/core" "^1.0.1"
    "@fusioncharts/datatable" "^1.0.1"
    "@fusioncharts/features" "^1.0.1"
    "@fusioncharts/fusiontime" "^1.3.0"
    "@fusioncharts/maps" "^3.14.1"
    "@fusioncharts/powercharts" "^3.14.1"
    "@fusioncharts/utils" "^1.0.1"
    "@fusioncharts/widgets" "^3.14.1"
    mutationobserver-shim "^0.3.3"
    promise-polyfill "^8.1.3"
 

 

Share this post


Link to post
Share on other sites

This does appear to be a packaging bug.

I added run-script-os:

yarn add run-script-os

Then added this into the scripts section of my package.json: 

    "install": "run-script-os",
    "install:linux": "find node_modules/@fusioncharts -type f -exec sed -i 's|../../../fc-utils|../../../utils|g' {} \\;",
    "install:darwin": "find node_modules/@fusioncharts -type f -exec sed -i '' 's|../../../fc-utils|../../../utils|g' {} \\;"

Things work great after that. (The only reason for run-script-os is because sed is implemented differently on Linux and Mac (which draws from NeXT heritage) and so need slightly different arguments. 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now