Monday, 13 December 2021

Unable to add library(intl-messageformat) to ojet project

I am trying to add intl-messageformat to my project, but i am getting undefined when i tried to load the module.

In path_mapping.json

{
    ...
    "libs": {
        ...
        "intl-messageformat": {
            "cdn": "3rdparty",
            
            "cwd": "node_modules/intl-messageformat",
            "debug": {
              "src": ["**"],
              "path": "libs/intl-messageformat/intl-messageformat.iife.js"
            },
            "release": {
                "src": ["**"],
                "path": "libs/intl-messageformat/intl-messageformat.iife.js"
            }
          }
    }
}

In main.js , i have added path

'intl-messageformat' :'libs/intl-messageformat/intl-messageformat.iife'

In viewmodel

define([
    'require',
    'ojs/ojcore',
    'knockout',
    'ojs/ojtable',
    'intl-messageformat'
], function (require) {
    'use strict';
    const ko = require('knockout');
    var messageformat = require('intl-messageformat');
    console.log(messageformat); //undefined

Versions

OJET : 11.1.0

intl-messageformat: 9.10.0



from Unable to add library(intl-messageformat) to ojet project

No comments:

Post a Comment