From 011774fd34589b570c7971325d689120335b6daa Mon Sep 17 00:00:00 2001 From: cristijora Date: Sat, 15 Apr 2017 21:54:32 +0300 Subject: [PATCH] Initial commit --- package.json | 25 ++++++++++++++ webpack.build.config.js | 74 +++++++++++++++++++++++++++++++++++++++++ webpack.dev.config.js | 67 +++++++++++++++++++++++++++++++++++++ 3 files changed, 166 insertions(+) create mode 100644 package.json create mode 100644 webpack.build.config.js create mode 100644 webpack.dev.config.js diff --git a/package.json b/package.json new file mode 100644 index 0000000..55c8e88 --- /dev/null +++ b/package.json @@ -0,0 +1,25 @@ +{ + "name": "vue-tab-wizard", + "version": "1.0.0", + "description": "A vue based tab wizard", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/cristijora/vue-tab-wizard.git" + }, + "keywords": [ + "vue" + ], + "author": "Cristi Jora", + "license": "ISC", + "bugs": { + "url": "https://github.com/cristijora/vue-tab-wizard/issues" + }, + "homepage": "https://github.com/cristijora/vue-tab-wizard#readme", + "devDependencies": { + "vue": "^2.2.6" + } +} diff --git a/webpack.build.config.js b/webpack.build.config.js new file mode 100644 index 0000000..97c0ac2 --- /dev/null +++ b/webpack.build.config.js @@ -0,0 +1,74 @@ +var webpack = require("webpack"); +var version = require("./package.json").version; +var banner = "/**\n" + " * vue-form-generator v" + version + "\n" + " * https://github.com/icebob/vue-form-generator\n" + " * Released under the MIT License.\n" + " */\n"; +var ExtractTextPlugin = require("extract-text-webpack-plugin"); +var StatsPlugin = require("stats-webpack-plugin"); + +var loaders = [ + { + "test": /\.js?$/, + "exclude": /node_modules/, + "loader": "babel" + }, + { + "test": /\.vue?$/, + "loader": "vue" + } +]; +var cssFileName; +if (process.env.FULL_BUNDLE) { + cssFileName = "vfg.css"; +} else { + cssFileName = "vfg-core.css"; +} + +module.exports = [ + { + entry: "./src/index.js", + output: { + path: "./dist", + filename: "vfg.js", + library: "VueFormGenerator", + libraryTarget: "umd" + }, + + plugins: [ + new webpack.DefinePlugin({ + "process.env" : { + NODE_ENV : JSON.stringify("production") + } + }), + new webpack.optimize.UglifyJsPlugin({ + compress: { + warnings: false + } + }), + new webpack.optimize.DedupePlugin(), + new webpack.BannerPlugin(banner, { + raw: true + }), + new ExtractTextPlugin(cssFileName, { allChunks: true }), + new StatsPlugin("../stats.json", { + chunkModules: true + //exclude: [/node_modules[\\\/]react/] + }) + ], + + module: { + loaders + }, + + vue: { + loaders: { + css: ExtractTextPlugin.extract("css"), + postcss: ExtractTextPlugin.extract("css"), + sass: ExtractTextPlugin.extract("css!sass"), + } + }, + + resolve: { + packageAlias: "browser" + } + } + +]; \ No newline at end of file diff --git a/webpack.dev.config.js b/webpack.dev.config.js new file mode 100644 index 0000000..c43c390 --- /dev/null +++ b/webpack.dev.config.js @@ -0,0 +1,67 @@ +var path = require("path"); +var webpack = require("webpack"); +var projectRoot = path.resolve(__dirname, '../'); + +var loaders = [ + { + test: /\.vue$/, + loader: 'vue' + }, + { + test: /\.js$/, + loader: 'babel', + include: projectRoot, + exclude: /node_modules/ + }, + { + test: /\.json$/, + loader: 'json' + }, + { + test: /\.(woff2?|svg)$/, + loader: "url" + //loader: "url?limit=10000" + }, + { + test: /\.(ttf|eot)$/, + loader: "url" + } +]; + +module.exports = { + devtool: "source-map", + + entry: { + full: path.resolve("dev", "full", "main.js"), + mselect: path.resolve("dev", "multiselect", "main.js") + }, + + output: { + path: path.resolve("dev"), + filename: "[name].js", + publicPath: "/" + }, + + plugins: [ + new webpack.DefinePlugin({ + "process.env": { + NODE_ENV: JSON.stringify("development"), + FULL_BUNDLE: true + } + }), + ], + + module: { + loaders + }, + + resolve: { + packageAlias: "browser" + }, + + vue: { + autoprefixer: { + browsers: ["last 2 versions"] + } + } +};