Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const ExtractTextPlugin = require("extract-text-webpack-plugin");
- const webpack = require("webpack");
- const path = require("path");
- const VueLoaderPlugin = require('vue-loader/lib/plugin');
- const UglifyJsPlugin = require("uglifyjs-webpack-plugin");
- module.exports = {
- optimization: {
- minimizer: [new UglifyJsPlugin({
- include: /\.min\.bundle\.js$/,
- sourceMap: false,
- parallel: true,
- })],
- },
- entry: {
- index: "./src/app.js",
- "index.min": "./src/app.js"
- },
- stats: { warnings: false }, // Hide warnings
- output: {
- path: path.resolve(__dirname, "dist"),
- filename: "scripts/[name].bundle.js"
- },
- module: {
- rules: [
- {
- test: /\.vue$/,
- loader: "vue-loader",
- options: {
- loaders: {
- // Since sass-loader (weirdly) has SCSS as its default parse mode, we map
- // the "scss" and "sass" values for the lang attribute to the right configs here.
- // other preprocessors should work out of the box, no loader config like this necessary.
- scss: "vue-style-loader!css-loader!sass-loader",
- sass: "vue-style-loader!css-loader!sass-loader?indentedSyntax"
- }
- }
- },
- {
- test: /\.js$/,
- exclude: /(node_modules)/,
- use: {
- loader: "babel-loader",
- options: {
- presets: [
- [
- "env",
- {
- targets: {
- browsers: [
- "Chrome >= 52",
- "FireFox >= 44",
- "Safari >= 7",
- "Explorer 11",
- "last 4 Edge versions"
- ]
- },
- useBuiltIns: true
- }
- ],
- "stage-2"
- ]
- }
- }
- },
- {
- test: /\.css$/,
- use: ExtractTextPlugin.extract({
- fallback: "style-loader",
- use: [
- { loader: "css-loader", options: { importLoaders: 1 } },
- "postcss-loader"
- ]
- })
- },
- {
- test: /\.(png|svg|jpg|gif)$/,
- use: [
- {
- loader: "file-loader",
- options: {
- name: "img/[name].[ext]"
- }
- }
- ]
- },
- {
- test: /\.(png|woff|woff2|eot|ttf|svg)$/,
- use: {
- loader: "file-loader",
- options: {
- name: "fonts/[name].[ext]"
- }
- }
- }
- ]
- },
- resolve: {
- alias: {
- vue$: "vue/dist/vue.esm.js"
- }
- },
- plugins: [
- new VueLoaderPlugin(),
- new webpack.ProvidePlugin({
- throttle: "lodash.throttle"
- }),
- // new UglifyJsPlugin({
- // include: /\.min\.bundle\.js$/,
- //minimize: false,
- // ecma: 8
- // }),
- new webpack.LoaderOptionsPlugin({
- //minimize: true
- }),
- new ExtractTextPlugin("styles.css")
- ],
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement