Git Product home page Git Product logo

Comments (5)

dylrich avatar dylrich commented on August 23, 2024

Adding require("aws-sdk/dist/aws-sdk"); before importing SQLite 3 fixes this for me, although WebPack is still complaining and I imagine I would need to put something in vue.config.js to get it to shut up. This is obviously not an ideal solution, but any thoughts on fixing this weird issue would be wonderful

from vue-cli-plugin-electron-builder.

dylrich avatar dylrich commented on August 23, 2024

One more update: After moving the import from a forked process into my main process, I can no longer launch my app. I've described the error in detail here: https://stackoverflow.com/questions/51466585/webpack-fails-to-compile-vue-electron-project-with-sqlite3

from vue-cli-plugin-electron-builder.

nklayman avatar nklayman commented on August 23, 2024

This issue appears to be unrelated to my plugin, so I will close it (but continue to help you if I can). I found a question thread that has some information that may be useful to you. Also, check out electron native modules documentation. An alternative would be to use sql.js, which does not use native modules. I tried this and it worked fine.

from vue-cli-plugin-electron-builder.

nklayman avatar nklayman commented on August 23, 2024

It's a little late, but I have a fix for you. Set vue.config.js to:

module.exports = {
    pluginOptions: {
        electronBuilder: {
            chainWebpackRendererProcess: config => {
                config.module
                    .rule('node-loader')
                    .test(/\.node$/)
                    .use('node')
                    .loader('node-loader')
                config.resolve.alias.set(
                    'sqlite3',
                    'sqlite3/lib/binding/electron-v2.0-YOUR_PLATFORM_HERE-x64/node_sqlite3.node'
                )
                return config
            }
        }
    }
}

and install node-loader. Before running serve:electron, run yarn electron-builder install-app-deps. You only have to do this in-between installing node_modules and running serve:electron.

from vue-cli-plugin-electron-builder.

nklayman avatar nklayman commented on August 23, 2024

1.0.0-rc.1 has landed with support for native modules. Upgrade to the latest version of vcp-electron-builder, and re-invoke the generator. Then, sqlite3 should work fine. The generator will not effect any code other than adding the missing requirements for native modules. You can also remove the config I suggested above.

from vue-cli-plugin-electron-builder.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.