Skip to content

Instantly share code, notes, and snippets.

@samlovescoding
Created June 27, 2020 06:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save samlovescoding/a476728a60ab5542cfe9fd79327cdd5c to your computer and use it in GitHub Desktop.
Save samlovescoding/a476728a60ab5542cfe9fd79327cdd5c to your computer and use it in GitHub Desktop.
Webpack for Electron and Vue
{
"name": "webpack-electron-vue",
"version": "1.0.0",
"description": "Boilerplate for Webpack Electron Vue App",
"main": "index.js",
"scripts": {
"start": "npm run build && npm run serve",
"build": "webpack --config webpack.config.js",
"watch": "webpack --config webpack.config.js --watch",
"serve": "electron ."
},
"author": "samlovescoding",
"license": "MIT",
"dependencies": {
"axios": "^0.19.2",
"bootstrap": "^4.5.0",
"electron": "^9.0.5",
"jquery": "^3.5.1",
"lodash": "^4.17.15",
"popper.js": "^1.16.1",
"sass": "^1.26.9",
"vue": "^2.6.11",
"vue-template-compiler": "^2.6.11"
},
"devDependencies": {
"@babel/core": "^7.10.3",
"@babel/preset-env": "^7.10.3",
"babel-loader": "^8.1.0",
"css-loader": "^3.6.0",
"file-loader": "^6.0.0",
"sass-loader": "^8.0.2",
"style-loader": "^1.2.1",
"vue-loader": "^15.9.3",
"webpack": "^4.43.0",
"webpack-cli": "^3.3.12"
}
}
const path = require('path');
const VueLoaderPlugin = require('vue-loader/lib/plugin')
publicPath = "public"
module.exports = {
entry: './src/main.js',
mode: 'development',
output: {
filename: 'main.js',
path: path.resolve(__dirname, publicPath),
},
module: {
rules: [
{
test: /\.s[ac]ss$/,
use: [
'style-loader',
'css-loader',
'sass-loader'
]
},
{
test: /\.css$/,
use: [
'style-loader',
'css-loader'
]
},
{
test: /\.(woff|woff2|ttf|otf)$/,
loader: 'file-loader',
include: [/fonts/],
options: {
name: '[name].[ext]',
outputPath: 'fonts/',
publicPath: url => '/fonts/' + url
}
},
{
test: /\.vue$/,
use: [
'vue-loader'
]
}
]
},
plugins: [
new VueLoaderPlugin()
],
optimization:{
minimize: true
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment