Skip to content
This repository was archived by the owner on Feb 18, 2024. It is now read-only.
This repository was archived by the owner on Feb 18, 2024. It is now read-only.

Building npm module #84

@heygrady

Description

@heygrady

I want to use Neutrino to create NPM modules. I had figured I could use neutrino-preset-node for this. I'm having some trouble getting it working.

  1. Create a new project, following the manual.
  2. Build the project with yarn build (I added the build script mentioned in the manual)
  3. Notice that the build folder contains an index.js

That's all well and good but it doesn't seem quite right.

Issues

  • The first line of build/index.js looks like it references my local computer. That's no good if I want to deploy my module to NPM.

    require('/a/path/on/my/laptop/my-neutrino-based-npm-module/node_modules/source-map-support/source-map-support.js').install();
  • When I link my module — using npm link — and link it into a local project — using npm link my-neutrino-based-npm-module — I get webpack errors. I'm importing my module into a react-redux-starter-kit project.

    import something from 'my-neutrino-based-npm-module'

    This is the error I get

    ERROR in /a/path/on/my/laptop/my-neutrino-based-npm-module/build/index.js
    Module build failed: ReferenceError: Unknown plugin "transform-runtime" specified in "base" at 0, attempted to resolve relative to "/a/path/on/my/laptop/my-neutrino-based-npm-module/build"
      at /a/path/on/my/laptop/react-redux-starter-kit-example/node_modules/babel-core/lib/transformation/file/options/option-manager.js:180:17
      at Array.map (native)
      at Function.normalisePlugins (/a/path/on/my/laptop/react-redux-starter-kit-example/node_modules/babel-core/lib/transformation/file/options/option-manager.js:158:20)
      at OptionManager.mergeOptions (/a/path/on/my/laptop/react-redux-starter-kit-example/node_modules/babel-core/lib/transformation/file/options/option-manager.js:234:36)
      at OptionManager.init (/a/path/on/my/laptop/react-redux-starter-kit-example/node_modules/babel-core/lib/transformation/file/options/option-manager.js:368:12)
      at File.initOptions (/a/path/on/my/laptop/react-redux-starter-kit-example/node_modules/babel-core/lib/transformation/file/index.js:216:65)
      at new File (/a/path/on/my/laptop/react-redux-starter-kit-example/node_modules/babel-core/lib/transformation/file/index.js:139:24)
      at Pipeline.transform (/a/path/on/my/laptop/react-redux-starter-kit-example/node_modules/babel-core/lib/transformation/pipeline.js:46:16)
      at transpile (/a/path/on/my/laptop/react-redux-starter-kit-example/node_modules/babel-loader/lib/index.js:46:20)
      at /a/path/on/my/laptop/react-redux-starter-kit-example/node_modules/babel-loader/lib/fs-cache.js:79:18
          at ReadFileContext.callback (/a/path/on/my/laptop/react-redux-starter-kit-example/node_modules/babel-loader/lib/fs-cache.js:15:14)
          at FSReqWrap.readFileAfterOpen [as oncomplete] (fs.js:365:13)
       @ ./src/routes/Home/components/HomeView.js 11:24-53
    

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions