Ver código fonte

[ADD] Config webpack

adrielso 6 anos atrás
pai
commit
9999eb21b3
4 arquivos alterados com 110 adições e 0 exclusões
  1. 10 0
      .babelrc
  2. 3 0
      .gitignore
  3. 45 0
      package.json
  4. 52 0
      webpack.config.js

+ 10 - 0
.babelrc

@@ -0,0 +1,10 @@
+{
+    "presets": [
+        [
+            "env", {
+                "modules": false
+            }
+        ],
+        "stage-2"
+    ]
+}

+ 3 - 0
.gitignore

@@ -1 +1,4 @@
 *.pyc
+node_modules
+static/src
+yarn.lock

+ 45 - 0
package.json

@@ -0,0 +1,45 @@
+{
+  "name": "eiru_bank_statement",
+  "version": "1.0.0",
+  "main": "index.js",
+  "license": "MIT",
+  "private": true,
+  "scripts": {
+    "start": "export NODE_ENV=development && ./node_modules/.bin/webpack --watch --config webpack.config.js",
+    "build": "export NODE_ENV=production && ./node_modules/.bin/webpack --progress --config webpack.config.js"
+  },
+  "devDependencies": {
+    "babel-core": "^6.26.3",
+    "babel-loader": "^8.0.4",
+    "babel-preset-env": "^1.7.0",
+    "babel-preset-stage-2": "^6.24.1",
+    "copy-webpack-plugin": "^4.6.0",
+    "css-loader": "0.28.9",
+    "extract-text-webpack-plugin": "^3.0.2",
+    "file-loader": "1.1.6",
+    "hard-source-webpack-plugin": "^0.12.0",
+    "node-sass": "^4.9.4",
+    "offline-plugin": "^5.0.5",
+    "pug": "^2.0.3",
+    "sass-loader": "^7.1.0",
+    "style-loader": "^0.23.1",
+    "url-loader": "^1.1.2",
+    "vue-loader": "^15.4.2",
+    "vue-template-compiler": "^2.5.17",
+    "webpack": "^4.23.1",
+    "webpack-cli": "^3.1.2",
+    "webpack-livereload-plugin": "^2.1.1"
+  },
+  "dependencies": {
+    "axios": "^0.18.0",
+    "fuse.js": "^3.3.0",
+    "install": "^0.12.2",
+    "velocity-animate": "^1.5.2",
+    "vue": "^2.5.17",
+    "vue-form-wizard": "^0.8.4",
+    "vue-js-modal": "^1.3.26",
+    "vue2-datepicker": "^2.6.2",
+    "vuex": "^3.0.1",
+    "vuex-persistedstate": "^2.5.4"
+  }
+}

+ 52 - 0
webpack.config.js

@@ -0,0 +1,52 @@
+var Path = require('path');
+var LiveReloadPlugion = require('webpack-livereload-plugin')
+var ExtractTextPlugin = require('extract-text-webpack-plugin')
+var prod = process.env.NODE_ENV === 'production'
+
+module.exports = {
+    entry: Path.resolve('src/index.js'),
+    output: {
+        path: Path.resolve('static/src'),
+        filename: 'main.js'
+    },
+    resolve: {
+        extensions: ['.js', '.vue', '.json'],
+        alias: {
+            'vue$': 'vue/dist/vue.esm.js',
+            '@': Path.resolve('src')
+        }
+    },
+    plugin: [
+        new LiveReloadPlugion(),
+        new ExtractTextPlugin('main.css')
+    ],
+    module: {
+        relues: [
+            {
+                test: /\.vue$/,
+                loader: 'vue-loader',
+                options: {
+                    extractCSS: prod
+                }
+            },
+            {
+                test: /\.js$/,
+                exclude: /node_modules/,
+                loader: 'babel-loader',
+                include: Path.resolve('src')
+            },
+            {
+                test: /\.css$/,
+                loader: ['style-loader', 'css-loader']
+            },
+            {
+                test: /\.(png|jpe?g|git|svg)(\?.*)?$/,
+                loader: 'url-loader',
+                options: {
+                    limit: 10000,
+                    name: Path.posix.join('static','img/[name].[hash:7].[ext]')
+                }
+            }
+        ]
+    }
+}