UNPKG

newlogic

Version:

Circuit Builder Desktop Application (like mmlogic) made with Electron + React Typescript. Compatible with Windows, Mac and Linux.

161 lines (147 loc) 3.77 kB
/** * Build config for electron "Renderer Process" file */ const path = require("path"); const webpack = require("webpack"); const ExtractTextPlugin = require("extract-text-webpack-plugin"); const merge = require("webpack-merge"); const HtmlWebpackPlugin = require("html-webpack-plugin"); const baseConfig = require("./webpack.config.base"); module.exports = merge(baseConfig, { devtool: "cheap-module-source-map", entry: [ "./app/index" ], output: { path: path.join(__dirname, "app/dist"), publicPath: "../dist/" }, module: { loaders: [ { test: /\.global\.css$/, loaders: [ "style-loader", "css-loader?sourceMap" ] }, { test: /^((?!\.global).)*\.css$/, loaders: [ "style-loader", "css-loader?modules&sourceMap&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]" ] }, // Add SASS support - compile all .global.scss files and pipe it to style.css { test: /\.global\.scss$/, use: [ { loader: "style-loader" }, { loader: "css-loader", options: { sourceMap: true, }, }, { loader: "sass-loader" } ] }, // Add SASS support - compile all other .scss files and pipe it to style.css { test: /^((?!\.global).)*\.scss$/, use: [ { loader: "style-loader" }, { loader: "css-loader", options: { modules: true, sourceMap: true, importLoaders: 1, localIdentName: "[name]__[local]__[hash:base64:5]", } }, { loader: "sass-loader" } ] }, // WOFF Font { test: /\.woff(\?v=\d+\.\d+\.\d+)?$/, use: { loader: "url-loader", options: { limit: 10000, mimetype: "application/font-woff", } }, }, // WOFF2 Font { test: /\.woff2(\?v=\d+\.\d+\.\d+)?$/, use: { loader: "url-loader", options: { limit: 10000, mimetype: "application/font-woff", } } }, // TTF Font { test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, use: { loader: "url-loader", options: { limit: 10000, mimetype: "application/octet-stream" } } }, // EOT Font { test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, use: "file-loader", }, // SVG Font { test: /\.svg(\?v=\d+\.\d+\.\d+)?$/, use: { loader: "url-loader", options: { limit: 1000000, mimetype: "image/svg+xml", } } }, // Common Image Formats { test: /\.(?:ico|gif|png|jpg|jpeg|webp)$/, use: "url-loader", } ] }, plugins: [ // https://webpack.github.io/docs/list-of-plugins.html#occurrenceorderplugin // https://github.com/webpack/webpack/issues/864 new webpack.optimize.OccurrenceOrderPlugin(), // NODE_ENV should be production so that modules do not perform certain development checks new webpack.DefinePlugin({ "process.env.NODE_ENV": JSON.stringify("production") }), new ExtractTextPlugin("style.css"), new HtmlWebpackPlugin({ filename: "../app.html", template: "app/app.html", inject: false }) ], // https://github.com/chentsulin/webpack-target-electron-renderer#how-this-module-works target: "electron-renderer" });