webpack-contrib / node-loader

node loader for native modules

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Not working a 'node-iconv' modules

bitmapdata opened this issue · comments

node-iconv project use a iconv.node

this code here iconv/lib/iconv.js at line 26 bindings = require('../build/Release/iconv.node');

I replaced
bindings = require('../build/Release/iconv.node');
with
bindings = require('node!../build/Release/iconv.node');

also removed at line 29 bindings = require('../build/Debug/iconv.node'); because the file does not exist.

I have checked the bindings but value is undefined

@bitmapdata Still relevant? 😛 Can you please provide more info like webpack.config.js webpack/node/node-gyp version?

you can let Webpack ignore "../build/Debug/iconv.node" by adding some configuration.

webpack.config.js

module.exports = {
  externals: /Debug\/iconv\.node/
};

I think better to do this:

{
  resolve: {
    alias: {
      './build/Debug/iconv.node$': path.resolve(
        __dirname,
        'node_modules/iconv/build/Release/iconv.node'
      ),
    },
  },
}

Just say to webpack that Debug is Build directory