Skip to content
This repository was archived by the owner on Apr 8, 2020. It is now read-only.
This repository was archived by the owner on Apr 8, 2020. It is now read-only.

"Cannot find module" error when pre-rendering is on. #244

Closed
@astegmaier

Description

@astegmaier

I'm trying to get server-side-rendering working with a third-party component (wijmo flexgrid), but I'm running into trouble. I'm not sure if this is possible, but I seem to be hitting a very basic error that I think might be a more general problem--either a limitation in asp.net/node or an error on my part.

I can get things working in the Angular2Spa template, so long as I turn off server-side rendering (by removing the asp-prerender-module* tags from Index.cshtml in the template). However, when I turn server-side rendering back on and try to load in the browser, I get this error:

Exception: Call to Node module failed with error: Error: Cannot find module '../../../vendor/node_modules/wijmo/wijmo.angular2.grid'
at Function.Module._resolveFilename (module.js:325:15)

It seems that the following import statement (in ClientApp/components/grid-test/grid-test.component.ts) will resolve fine in the browser, but can't resolve on the server:

import { WjFlexGrid, WjFlexGridColumn } from '../../../vendor/node_modules/wijmo/wijmo.angular2.grid';

Does anyone have any ideas what could cause this type of error? I didn't change anything about load-client.ts or load-server.ts, so it's puzzling.

To see details about exactly what I'm doing, I cloned the template and made a simple repro--see my checkin here: https://github.com/astegmaier/JavaScriptServices/commit/275449c39047630662ec27187210e20591787250

Thanks in advance for any ideas!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions