question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Context-aware native module support?

See original GitHub issue

I added sqlite3 native module with TypeORM to my project. Here is my new angular.webpack.json file:

/**
 * Custom angular webpack configuration
 */

const path = require('path');

module.exports = (config, options) => {
    config.target = 'electron-renderer';
    if (options.customWebpackConfig.target) {
        config.target = options.customWebpackConfig.target;
    } else if (options.fileReplacements) {
        for(let fileReplacement of options.fileReplacements) {
            if (fileReplacement.replace !== 'src/environments/environment.ts') {
                continue;
            }
            let fileReplacementParts = fileReplacement['with'].split('.');
            if (['dev', 'prod', 'test', 'electron-renderer'].indexOf(fileReplacementParts[1]) < 0) {
                config.target = fileReplacementParts[1];
            }
            break;
        }
    }
    config.externals = {
        'typeorm': "require('typeorm')",
        'sqlite3': "require('sqlite3')",
        'react-native-sqlite-storage': 'react-native-sqlite-storage'
    };
    config.resolve = {
        alias: {
            typeorm: path.resolve(__dirname, '../node_modules/typeorm/typeorm-model-shim')
        }
    };
    return config;
}

I get this warning at compile time:

Electron: Loading non context-aware native modules in the renderer process is deprecated and will stop working at some point in the future, please see https://github.com/electron/electron/issues/18397 for more information

Any clue on how to prevent this?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
Css-IanMcommented, Jan 4, 2020

You would use this to communicate between the main (‘main.ts’) process, dispatched using this service from the renderer process. You wont see the warning, and more importantly since its a deprecation your app will work in future versions.

For more information regarding the context of the electron processes see here

0reactions
stale[bot]commented, Jan 19, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

non-context-aware native module - Automattic/node-canvas
Seeing this while running an Electron app. Uncaught Error: Loading non-context-aware native module in renderer: './node_modules/canvas/build/ ...
Read more >
Electron non-context-aware native module in renderer issue
I have tried many things and can not seem to get the robotjs code to execute even with rebuild, and other examples I've...
Read more >
Context awareness · The Node-API Resource - GitHub Pages
Worker Threads add a JavaScript-friendly concurrency abstraction that native add-on developers need to be aware of. What this means practically is that your ......
Read more >
Electronjs, preload.js, NON context aware native modules not ...
I'm using module to create dedicated client with WEB NFC compliance/emulator for desktop OS (WEB NFC currently works on mobile only).
Read more >
Native Node Modules | Electron
Native Node.js modules are supported by Electron, but since Electron has a different application binary interface (ABI) from a given Node.js binary (due...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found