Skip to content

Commit 223e65e

Browse files
committed
Now using resolve-cwd because require.resolve doesn't work after browserify is run.
1 parent fd65106 commit 223e65e

File tree

3 files changed

+29
-12
lines changed

3 files changed

+29
-12
lines changed

package-lock.json

+25-10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "data-forge-plot",
3-
"version": "0.6.2",
3+
"version": "0.6.3",
44
"description": "Plotting API for use with Data-Forge.",
55
"main": "build/index.js",
66
"types": "build/index.d.ts",
@@ -40,6 +40,7 @@
4040
"@data-forge/serialization": "^1.0.0",
4141
"inflate-template": "^1.1.6",
4242
"opn": "^5.5.0",
43+
"resolve-cwd": "^3.0.0",
4344
"typy": "^3.0.1"
4445
},
4546
"peerDependencies": {

src/plot-api.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { isObject } from "./utils";
77
import { ChartType, IChartDef, AxisType, HorizontalLabelPosition, VerticalLabelPosition, IAxisConfig, IYAxisSeriesConfig, IAxisSeriesConfig, IXAxisConfig, IYAxisConfig } from "@data-forge-plot/chart-def";
88
import { expandChartDef } from "./expand-chart-def";
99
import { applyDefaults } from "./apply-defaults";
10+
const resolve = require('resolve-cwd');
1011

1112
const DEFAULT_CHART_PACKAGE = "@data-forge-plot/apex";
1213

@@ -17,7 +18,7 @@ const DEFAULT_CHART_PACKAGE = "@data-forge-plot/apex";
1718
// TODO :export let globalChartRenderer: IChartRenderer | null = null;
1819

1920
export async function findChartTemplatePath(): Promise<string> {
20-
const defaultTemplatePath = require.resolve(`${DEFAULT_CHART_PACKAGE}/build/template/template.json`);
21+
const defaultTemplatePath = resolve(`${DEFAULT_CHART_PACKAGE}/build/template/template.json`);
2122
const chartTemplatesPath = path.dirname(defaultTemplatePath);
2223
return chartTemplatesPath;
2324
}

0 commit comments

Comments
 (0)