Skip to content

WebpackError: Cannot set property 'engineResourcePath' of undefined #72

@rubenkuipers

Description

@rubenkuipers

I have followed your webpack example and I'm trying to implement this example into a Gatsby app.
During development, when running in the browser, everything is running fine with the config below:

services/dbr.js

/* eslint-disable no-console */
import { BarcodeReader, BarcodeScanner } from "dynamsoft-javascript-barcode";

BarcodeReader.engineResourcePath = "/dbr/"; // Static folder path

// Please visit https://www.dynamsoft.com/customer/license/trialLicense to get a trial license
BarcodeReader.productKeys = process.env.GATSBY_DYNAMSOFT_TRIAL_KEY;

BarcodeScanner.bPlaySoundOnSuccessfulRead = true;

// DBR.BarcodeReader._bUseFullFeature = true; // Control of loading min wasm or full wasm.
export {
    BarcodeReader,
    BarcodeScanner
}

But when I try to build the app using npm run build = gatsby build, I get the following message:
WebpackError: TypeError: Cannot set property 'engineResourcePath' of undefined on line 4

Any idea what is going wrong here?

My versions:
node: v12.20.0
javascript-barcode: 8.0
gatsby: 2.28.1

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