Giter Club home page Giter Club logo

electron-native-plugin-samples's People

Contributors

evonox avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

electron-native-plugin-samples's Issues

unable to install sqlite3

Have tried several different configurations but can't seem to get this right. No matter what I do it appears the rebuild is looking for a node_modules dir that isn't there. thoughts?

[0] Rebuilding native module sqlite3...
[0]
[0] An unhandled error occurred inside electron-rebuild
[0] ENOENT: no such file or directory, lstat '/my-project-path/node_modules/sqlite3/node_modules'

webpack.js

const webpack = require('webpack');
const path = require('path');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const ElectronNativePlugin = require("electron-native-plugin");

const outputPath = path.resolve(__dirname, '../app/build');
module.exports = {
  mode: 'development',
  context: path.join(__dirname, '../app'),
  devtool: 'inline-source-map',
  entry: {
    app: [
        'react-hot-loader/patch',
        'webpack-dev-server/client?http://localhost:9000',
        'webpack/hot/only-dev-server',
        './src/main/components/index.tsx',
    ],
  },
  output: {
    path: outputPath,
    filename: 'app.bundle.js',
    publicPath: 'http://localhost:9000/',
  },
  resolve: {
    // changed from extensions: [".js", ".jsx"]
    extensions: [".ts", ".tsx", ".js", ".jsx"]
  },
  devServer: {
    hot: true,
    publicPath: 'http://localhost:9000/',
    historyApiFallback: true,
    port: 9000,
  },
  module: {
    rules: [
      {
        test: /\.tsx?$/,
        use: 'awesome-typescript-loader',
        exclude: /node_modules/
      },
      {
        test: /\.js$/,
        use: [
          { 
            loader: "electron-native-patch-loader",
            options: {
                custom: {
                  "sqlite3": {
                      "test": "sqlite3\\.js$",
                      "patches": [
                          {
                              "find": "var binding_path = binary.find(path.resolve(path.join(__dirname,'../package.json')));",
                              "isFindRegExp": false,
                              "replace": ""
                          },
                          {
                              "find": "require(binding_path);",
                              "isFindRegExp": false,
                              "replace": "require('./binding/node-v57-win32-x64/node_sqlite3.node')"
                          }
                      ]
                  }
              }
            }
         },
         {
          loader: "electron-native-loader",
            options: {
                outputPath: outputPath  // Set here your defined path for the output bundles, e.g. "./dist"
            }
          }
        ]
      },
      { 
        test: /\.node$/, 
        use: "electron-native-loader" 
      },
      // {
      //   test: /\.js$/,
      //   exclude: /node_modules/,
      //   use: {
      //     loader: 'babel-loader',
      //   },
      // },
      {
        test: /\.scss$/,
        use: ['style-loader', 'css-loader', 'sass-loader'],
      },
      {
        test: /\.(png|jpg|gif)$/,
        use: [{
          loader: 'file-loader',
          options: {},
        }],
      },
      { 
        enforce: "pre",
        test: /\.js$/,
        loader: "source-map-loader",
        exclude: /node_modules/
      }
    ],
  },
  plugins: [
    new ElectronNativePlugin(),
    new webpack.IgnorePlugin(/node-gyp/),
    new webpack.HotModuleReplacementPlugin(),
    new webpack.NamedModulesPlugin(),
    new CopyWebpackPlugin([{
      from: './src/main/app.js',
    },
    {
      from: './src/main/index.html',
    },
    ]),
  ],
  node: {
    fs: 'empty'
  }
};

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.