Skip to content
This repository was archived by the owner on May 7, 2021. It is now read-only.

fix(package.json): add entry point main for node packaging #158

Merged
merged 1 commit into from
Oct 10, 2018

Conversation

sahil143
Copy link
Contributor

@sahil143 sahil143 commented Oct 9, 2018

Issue:

With ngx-widgets version 3.1.2(#156) the directory structure changed for published package which caused the following error in planner

{ Error: /home/sbudhwar/node_modules/ngx-widgets/index.js: Couldn't find preset "env" relative to directory "/home/sbudhwar/node_modules/ngx-widgets"
Transform function: 

function (context, callback) {
        if (!context.js) {
            return callback(undefined, false);
        }
        if (isEs6(context.js.ast)) {
            options.filename = context.filename;
            log.debug("Transforming %s", options.filename);
            try {
                context.source = babel.transform(context.source, options).code;
                context.js.ast = acorn.parse(context.source, { sourceType: "module" });
                return callback(undefined, true);
            }
            catch (error) {
                return callback(error, false);
            }
        }
        else {
            return callback(undefined, false);
        }
    }

    at Transformer.handleError (/home/sbudhwar/fabric8/fabric8-planner/node_modules/karma-typescript/src/bundler/transformer.ts:103:19)
    at /home/sbudhwar/fabric8/fabric8-planner/node_modules/karma-typescript/src/bundler/transformer.ts:87:26
    at transform (/home/sbudhwar/fabric8/fabric8-planner/node_modules/karma-typescript-es6-transform/src/transform.ts:69:24)
    at /home/sbudhwar/fabric8/fabric8-planner/node_modules/karma-typescript/src/bundler/transformer.ts:86:17
    at _combinedTickCallback (internal/process/next_tick.js:131:7)
    at process._tickDomainCallback (internal/process/next_tick.js:218:9)
  domain: 
   Domain {
     domain: null,
     _events: {},
     _eventsCount: 0,
     _maxListeners: undefined,
     members: [] }

Cause:

main property was missing from the package.json which caused the node to look for an entry point in the root directory and because of the change in directory structure the entry point for the package resides in src/app/index.js

Solution:

Add main property in package.json with correct entry point

Copy link
Contributor

@nimishamukherjee nimishamukherjee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tried this with ng6 planner. Unit tests pass now.

@joshuawilson joshuawilson merged commit 742cc95 into master Oct 10, 2018
@joshuawilson joshuawilson deleted the bug-fix branch October 10, 2018 02:11
@fabric8cd
Copy link

🎉 This PR is included in version 3.1.4 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants