├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md └── workflows │ └── npm-publish.yml ├── .gitignore ├── .npmignore ├── .prettierrc.json ├── LICENSE ├── README.md ├── babel.config.js ├── deploy.sh ├── example ├── .babelrc ├── index.html ├── package-lock.json ├── package.json ├── src │ ├── App.vue │ ├── assets │ │ └── base.css │ ├── components │ │ ├── list-confirm-password.vue │ │ └── list-confirm.vue │ ├── main.js │ └── static │ │ └── confirm-dialog.png └── webpack.config.js ├── package-lock.json ├── package.json ├── public ├── favicon.ico └── index.html ├── src ├── events.js ├── index.js └── vue-confirm-dialog.vue ├── webpack.config.js └── webpack.config.ssr.js /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **Desktop (please complete the following information):** 27 | - OS: [e.g. iOS] 28 | - Browser [e.g. chrome, safari] 29 | - Version [e.g. 22] 30 | 31 | **Smartphone (please complete the following information):** 32 | - Device: [e.g. iPhone6] 33 | - OS: [e.g. iOS8.1] 34 | - Browser [e.g. stock browser, safari] 35 | - Version [e.g. 22] 36 | 37 | **Additional context** 38 | Add any other context about the problem here. 39 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /.github/workflows/npm-publish.yml: -------------------------------------------------------------------------------- 1 | # This workflow will run tests using node and then publish a package to GitHub Packages when a release is created 2 | # For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages 3 | 4 | name: Node.js Package 5 | 6 | on: 7 | release: 8 | types: [created] 9 | 10 | jobs: 11 | build: 12 | runs-on: ubuntu-latest 13 | steps: 14 | - uses: actions/checkout@v2 15 | - uses: actions/setup-node@v2 16 | with: 17 | node-version: 16 18 | - run: npm ci 19 | - run: npm test 20 | 21 | publish-npm: 22 | needs: build 23 | runs-on: ubuntu-latest 24 | steps: 25 | - uses: actions/checkout@v2 26 | - uses: actions/setup-node@v2 27 | with: 28 | node-version: 16 29 | registry-url: https://registry.npmjs.org/ 30 | - run: npm ci 31 | - run: npm publish 32 | env: 33 | NODE_AUTH_TOKEN: ${{secrets.npm_token}} 34 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | .DS_Store 3 | 4 | node_modules/ 5 | 6 | *.map 7 | example/dist 8 | 9 | 10 | # local env files 11 | .env.local 12 | .env.*.local 13 | 14 | # Log files 15 | npm-debug.log* 16 | yarn-debug.log* 17 | yarn-error.log* 18 | 19 | # Editor directories and files 20 | .idea 21 | .vscode 22 | *.suo 23 | *.ntvs* 24 | *.njsproj 25 | *.sln 26 | *.sw? 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | example -------------------------------------------------------------------------------- /.prettierrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "singleQuote": true, 3 | "semi": false, 4 | "tabWidth": 2, 5 | "trailingComma": "none" 6 | } 7 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Onur Aslan 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![issues](https://badgen.net/github/open-issues/aslanon/vue-confirm-dialog)](https://github.com/aslanon/vue-confirm-dialog/issues) [![npm](https://badgen.net/npm/dt/vue-confirm-dialog)](https://www.npmjs.com/package/vue-confirm-dialog) [![npm version](https://badge.fury.io/js/vue-confirm-dialog.svg)](https://www.npmjs.com/package/vue-confirm-dialog) [![license](https://badgen.net/github/license/aslanon/vue-confirm-dialog)](https://github.com/aslanon/vue-confirm-dialog/blob/master/LICENSE) 2 | 3 | # vue-confirm-dialog 4 | 5 | Simple Confirm Dialog verification plugin with Vue.js. 6 | 7 | Demo: https://aslanon.github.io/vue-confirm-dialog/ 8 | 9 | ![confirm-dialog](https://raw.githubusercontent.com/aslanon/vue-confirm-dialog/master/example/src/static/confirm-dialog.png) 10 | 11 | ![vue-confirm](https://media.giphy.com/media/KzDUV51RkigyVBsJgA/giphy.gif) 12 | 13 | ## Install 14 | 15 | ```bash 16 | $ npm install --save vue-confirm-dialog 17 | ``` 18 | 19 | ## Quick Start Usage 20 | 21 | In main.js or plugin (for Nuxt.js): 22 | 23 | ```js 24 | import Vue from 'vue' 25 | import VueConfirmDialog from 'vue-confirm-dialog' 26 | 27 | Vue.use(VueConfirmDialog) 28 | Vue.component('vue-confirm-dialog', VueConfirmDialog.default) 29 | ``` 30 | 31 | In App.vue (or in the template file for Nuxt.js (layout/default.vue)): 32 | 33 | ```html 34 | 40 | 41 | 46 | ``` 47 | 48 | In any of functions : 49 | 50 | ```js 51 | methods: { 52 | handleClick(){ 53 | this.$confirm( 54 | { 55 | message: 'Are you sure?', 56 | button: { 57 | no: 'No', 58 | yes: 'Yes' 59 | }, 60 | /** 61 | * Callback Function 62 | * @param {Boolean} confirm 63 | */ 64 | callback: confirm => { 65 | if (confirm) { 66 | // ... do something 67 | } 68 | } 69 | } 70 | ) 71 | } 72 | } 73 | ``` 74 | 75 | If you want to use in \*.js file (e.g Vuex Store) before import Vue and after use Vue.\$confirm. 76 | 77 | ```js 78 | import Vue from 'vue' 79 | 80 | export default { 81 | namespaced: true, 82 | state: {}, 83 | actions: { 84 | logout({ commit }) { 85 | Vue.$confirm({ 86 | title: 'Are you sure?', 87 | message: 'Are you sure you want to logout?', 88 | button: { 89 | yes: 'Yes', 90 | no: 'Cancel' 91 | }, 92 | callback: confirm => { 93 | // ...do something 94 | } 95 | }) 96 | } 97 | } 98 | } 99 | ``` 100 | 101 | ## API 102 | 103 | If you want to password confirm, "auth" key is must be true. 104 | 105 | ```js 106 | this.$confirm({ 107 | auth: true, 108 | message: 'foo', 109 | button: { 110 | yes: 'Yes', 111 | no: 'Cancel' 112 | }, 113 | /** 114 | * Callback Function 115 | * @param {Boolean} confirm 116 | * @param {String} password 117 | */ 118 | callback: (confirm, password) => { 119 | if (confirm && password == YOUR_PASSWORD) { 120 | // ...do something 121 | } 122 | } 123 | }) 124 | ``` 125 | 126 | ## Use only for information 127 | 128 | If you want to use only for information and you want of see one button in dialog, you can use only one of 'no' or 'yes' button object. 129 | 130 | ![vue-confirm](https://media.giphy.com/media/U3y0rmoC4SUySJxJqL/giphy.gif) 131 | 132 | ```js 133 | methods: { 134 | handleClick(){ 135 | this.$confirm( 136 | { 137 | title: 'Information', 138 | message: 'This content has been removed', 139 | button: { 140 | yes: 'OK', 141 | } 142 | }, 143 | /** 144 | * Callback Function 145 | * @param {Boolean} confirm 146 | */ 147 | callback: confirm => { 148 | if (confirm) { 149 | // ... do something 150 | } 151 | } 152 | ) 153 | } 154 | } 155 | ``` 156 | -------------------------------------------------------------------------------- /babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: ['@vue/app'] 3 | } 4 | -------------------------------------------------------------------------------- /deploy.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # abort on errors 4 | set -e 5 | 6 | # build 7 | npm run build 8 | 9 | # navigate into the build output directory 10 | cd dist 11 | 12 | # if you are deploying to a custom domain 13 | # echo 'www.example.com' > CNAME 14 | 15 | git init 16 | git add -A 17 | git commit -m 'deploy' 18 | 19 | # if you are deploying to https://.github.io 20 | # git push -f git@github.com:/.github.io.git master 21 | 22 | # if you are deploying to https://.github.io/ 23 | git push -f https://github.com/aslanon/vue-confirm-dialog.git master:gh-pages 24 | 25 | cd - -------------------------------------------------------------------------------- /example/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | [ 4 | "latest", 5 | { 6 | "es2015": { "modules": false } 7 | } 8 | ] 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /example/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | vue-confirm-dialog 8 | 9 | 10 | 16 |
17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /example/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "example", 3 | "version": "1.0.0", 4 | "scripts": { 5 | "dev": "cross-env NODE_ENV=development webpack-dev-server --open --hot", 6 | "build": "cross-env NODE_ENV=production webpack --progress --hide-modules" 7 | }, 8 | "dependencies": { 9 | "vue": "^2.6.10" 10 | }, 11 | "devDependencies": { 12 | "webpack-cli": "^3.2.3", 13 | "babel-core": "^6.0.0", 14 | "babel-loader": "^6.0.0", 15 | "babel-preset-latest": "^6.0.0", 16 | "cross-env": "^3.0.0", 17 | "css-loader": "^0.25.0", 18 | "file-loader": "^0.9.0", 19 | "node-sass": "^4.11.0", 20 | "sass-loader": "^5.0.1", 21 | "vue-loader": "^11.1.4", 22 | "vue-template-compiler": "^2.6.10", 23 | "webpack": "^2.2.0", 24 | "webpack-dev-server": "^3.1.11" 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /example/src/App.vue: -------------------------------------------------------------------------------- 1 | 18 | 19 | 35 | 36 | 67 | -------------------------------------------------------------------------------- /example/src/assets/base.css: -------------------------------------------------------------------------------- 1 | button { 2 | outline: none; 3 | border: none; 4 | border-radius: 8px; 5 | background-color: whitesmoke; 6 | font-weight: 700; 7 | font-size: 14px; 8 | height: 35px !important; 9 | cursor: pointer; 10 | transition: 0.25s ease; 11 | } 12 | 13 | button:hover { 14 | background-color: #c3c3c3; 15 | } 16 | 17 | h3 { 18 | font-size: 32px; 19 | padding-bottom: 0.5rem; 20 | text-transform: capitalize; 21 | text-align: left; 22 | border-bottom: 0.5px solid #0000003d; 23 | } 24 | 25 | ul { 26 | list-style: none; 27 | padding: 0; 28 | } 29 | 30 | ul li { 31 | padding: 1rem; 32 | margin-bottom: 1rem; 33 | border-radius: 0.5rem; 34 | text-align: left; 35 | /* border: 1px solid; */ 36 | border-color: rgb(207, 207, 207); 37 | box-shadow: 0 0 50px 0 rgba(0, 0, 0, 0.13); 38 | display: grid; 39 | grid-template-columns: 1fr auto; 40 | } 41 | 42 | ul li p { 43 | padding: 1rem; 44 | } 45 | -------------------------------------------------------------------------------- /example/src/components/list-confirm-password.vue: -------------------------------------------------------------------------------- 1 | 12 | 13 | 66 | -------------------------------------------------------------------------------- /example/src/components/list-confirm.vue: -------------------------------------------------------------------------------- 1 | 12 | 13 | 60 | -------------------------------------------------------------------------------- /example/src/main.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import App from './App.vue' 3 | import plugin from 'plugin' 4 | 5 | Vue.use(plugin) 6 | 7 | new Vue({ 8 | el: '#app', 9 | render: h => h(App) 10 | }) 11 | -------------------------------------------------------------------------------- /example/src/static/confirm-dialog.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aslanon/vue-confirm-dialog/14acc082873329e9bc70909956983d8edcf1ab26/example/src/static/confirm-dialog.png -------------------------------------------------------------------------------- /example/webpack.config.js: -------------------------------------------------------------------------------- 1 | var path = require('path') 2 | var webpack = require('webpack') 3 | 4 | module.exports = { 5 | entry: './src/main.js', 6 | output: { 7 | path: path.resolve(__dirname, './dist'), 8 | publicPath: '/dist/', 9 | filename: 'build.js' 10 | }, 11 | module: { 12 | rules: [ 13 | { 14 | test: /\.vue$/, 15 | loader: 'vue-loader', 16 | options: { 17 | loaders: { 18 | scss: 'vue-style-loader!css-loader!sass-loader', 19 | sass: 'vue-style-loader!css-loader!sass-loader?indentedSyntax' 20 | } 21 | } 22 | }, 23 | { 24 | test: /\.js$/, 25 | loader: 'babel-loader', 26 | exclude: /node_modules/ 27 | }, 28 | { 29 | test: /\.(png|jpg|gif|svg)$/, 30 | loader: 'file-loader', 31 | options: { 32 | name: '[name].[ext]?[hash]' 33 | } 34 | } 35 | ] 36 | }, 37 | resolve: { 38 | alias: { 39 | vue$: 'vue/dist/vue.esm.js', 40 | plugin: path.resolve(__dirname, '../dist/index.js') 41 | } 42 | }, 43 | devServer: { 44 | historyApiFallback: true, 45 | noInfo: true 46 | }, 47 | performance: { 48 | hints: false 49 | }, 50 | devtool: '#eval-source-map' 51 | } 52 | 53 | if (process.env.NODE_ENV === 'production') { 54 | module.exports.devtool = '#source-map' 55 | // http://vue-loader.vuejs.org/en/workflow/production.html 56 | module.exports.plugins = (module.exports.plugins || []).concat([ 57 | new webpack.DefinePlugin({ 58 | 'process.env': { 59 | NODE_ENV: '"production"' 60 | } 61 | }), 62 | new webpack.optimize.UglifyJsPlugin({ 63 | sourceMap: true, 64 | compress: { 65 | warnings: false 66 | } 67 | }), 68 | new webpack.LoaderOptionsPlugin({ 69 | minimize: true 70 | }) 71 | ]) 72 | } 73 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vue-confirm-dialog", 3 | "description": "simple action confirm", 4 | "version": "1.1.0", 5 | "author": "Onur Aslan ", 6 | "private": false, 7 | "main": "dist/index.js", 8 | "scripts": { 9 | "build:base": "cross-env NODE_ENV=production webpack --config webpack.config.js --progress --hide-modules", 10 | "build:ssr": "cross-env NODE_ENV=production webpack --config webpack.config.ssr.js --progress --hide-modules", 11 | "build": "npm run build:base && npm run build:ssr", 12 | "lint": "vue-cli-service lint" 13 | }, 14 | "peerDependencies": { 15 | "vue": "^2.6.10" 16 | }, 17 | "devDependencies": { 18 | "vue": "^2.6.10", 19 | "cross-env": "^3.0.0", 20 | "@vue/cli-plugin-babel": "^3.11.0", 21 | "@vue/cli-plugin-eslint": "^3.11.0", 22 | "@vue/cli-service": "^3.11.0", 23 | "@vue/eslint-config-prettier": "^5.0.0", 24 | "babel-eslint": "^10.0.1", 25 | "babel-core": "^6.26.3", 26 | "babel-loader": "^6.0.0", 27 | "babel-preset-env": "^1.7.0", 28 | "babel-preset-latest": "^6.0.0", 29 | "babel-preset-stage-2": "^6.24.1", 30 | "eslint": "^5.16.0", 31 | "eslint-plugin-prettier": "^3.1.0", 32 | "eslint-plugin-vue": "^5.0.0", 33 | "prettier": "^1.18.2", 34 | "vue-template-compiler": "^2.6.10", 35 | "vue-loader": "^11.1.4", 36 | "css-loader": "^0.25.0", 37 | "node-sass": "^4.11.0", 38 | "sass-loader": "^5.0.1", 39 | "file-loader": "^0.9.0", 40 | "webpack": "^2.7.0", 41 | "webpack-dev-server": "^3.1.11", 42 | "webpack-merge": "^4.1.1" 43 | }, 44 | "eslintConfig": { 45 | "root": true, 46 | "env": { 47 | "node": true 48 | }, 49 | "extends": [ 50 | "plugin:vue/essential", 51 | "@vue/prettier" 52 | ], 53 | "rules": {}, 54 | "parserOptions": { 55 | "parser": "babel-eslint" 56 | } 57 | }, 58 | "postcss": { 59 | "plugins": { 60 | "autoprefixer": {} 61 | } 62 | }, 63 | "browserslist": [ 64 | "> 1%", 65 | "last 2 versions" 66 | ], 67 | "repository": { 68 | "type": "git", 69 | "url": "git+https://github.com/aslanon/vue-confirm.git" 70 | }, 71 | "keywords": [ 72 | "vue", 73 | "confirm", 74 | "dialog", 75 | "popup", 76 | "plugin" 77 | ], 78 | "license": "MIT", 79 | "bugs": { 80 | "url": "https://github.com/aslanon/vue-confirm/issues" 81 | }, 82 | "homepage": "https://github.com/aslanon/vue-confirm#readme" 83 | } -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aslanon/vue-confirm-dialog/14acc082873329e9bc70909956983d8edcf1ab26/public/favicon.ico -------------------------------------------------------------------------------- /public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | vue-confirm-dialog 9 | 10 | 11 | 17 |
18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/events.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | 3 | export const events = new Vue({ 4 | name: 'vue-confirm-dialog' 5 | }) 6 | -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | import VueConfirmDialog from './vue-confirm-dialog.vue' 2 | import { events } from './events' 3 | 4 | export default { 5 | install(Vue, args = {}) { 6 | if (this.installed) return 7 | 8 | this.installed = true 9 | this.params = args 10 | 11 | Vue.component(args.componentName || 'vue-confirm-dialog', VueConfirmDialog) 12 | 13 | const confirm = params => { 14 | if (typeof params != 'object' || Array.isArray(params)) { 15 | let caughtType = typeof params 16 | if (Array.isArray(params)) caughtType = 'array' 17 | 18 | throw new Error( 19 | `Options type must be an object. Caught: ${caughtType}. Expected: object` 20 | ) 21 | } 22 | 23 | if (typeof params === 'object') { 24 | if ( 25 | params.hasOwnProperty('callback') && 26 | typeof params.callback != 'function' 27 | ) { 28 | let callbackType = typeof params.callback 29 | throw new Error( 30 | `Callback type must be an function. Caught: ${callbackType}. Expected: function` 31 | ) 32 | } 33 | events.$emit('open', params) 34 | } 35 | } 36 | confirm.close = () => { 37 | events.$emit('close') 38 | } 39 | 40 | Vue.prototype.$confirm = confirm 41 | Vue['$confirm'] = confirm 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/vue-confirm-dialog.vue: -------------------------------------------------------------------------------- 1 | 55 | 56 | 145 | 146 | 319 | -------------------------------------------------------------------------------- /webpack.config.js: -------------------------------------------------------------------------------- 1 | var path = require('path') 2 | var webpack = require('webpack') 3 | 4 | module.exports = { 5 | entry: './src/index.js', 6 | output: { 7 | path: path.resolve(__dirname, './dist'), 8 | publicPath: '/dist/', 9 | filename: 'index.js', 10 | library: 'vue-confirm-dialog', 11 | libraryTarget: 'umd' 12 | }, 13 | module: { 14 | rules: [ 15 | { 16 | test: /\.vue$/, 17 | loader: 'vue-loader', 18 | options: { 19 | loaders: { 20 | scss: 'vue-style-loader!css-loader!sass-loader', 21 | sass: 'vue-style-loader!css-loader!sass-loader?indentedSyntax' 22 | } 23 | } 24 | }, 25 | { 26 | test: /\.js$/, 27 | loader: 'babel-loader', 28 | exclude: /node_modules/ 29 | }, 30 | { 31 | test: /\.(png|jpg|gif|svg)$/, 32 | loader: 'file-loader', 33 | options: { 34 | name: '[name].[ext]?[hash]' 35 | } 36 | } 37 | ] 38 | }, 39 | externals: { 40 | vue: 'vue' 41 | }, 42 | resolve: { 43 | alias: { 44 | vue$: 'vue/dist/vue.esm.js' 45 | } 46 | }, 47 | devServer: { 48 | historyApiFallback: true, 49 | noInfo: true 50 | }, 51 | performance: { 52 | hints: false 53 | }, 54 | devtool: '#source-map', 55 | plugins: [ 56 | new webpack.DefinePlugin({ 57 | 'process.env': { 58 | NODE_ENV: '"production"' 59 | } 60 | }), 61 | new webpack.LoaderOptionsPlugin({ 62 | minimize: true 63 | }) 64 | ] 65 | } 66 | -------------------------------------------------------------------------------- /webpack.config.ssr.js: -------------------------------------------------------------------------------- 1 | var webpack = require('webpack') 2 | var merge = require('webpack-merge') 3 | var base = require('./webpack.config') 4 | 5 | module.exports = merge(base, { 6 | target: 'node', 7 | output: { 8 | filename: 'ssr.js' 9 | } 10 | }) 11 | --------------------------------------------------------------------------------