Skip to content

Commit

Permalink
Merge pull request #44 from veronichka124/webpack
Browse files Browse the repository at this point in the history
updated webpack.config to fix bug for dev
  • Loading branch information
veronichka124 authored Sep 6, 2024
2 parents 7a6b0cd + 608881d commit ddec568
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 47 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ yarn-error.log
*.ntvs*
*.njsproj
*.sln
.vscode/*
92 changes: 45 additions & 47 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,86 +1,84 @@
var path = require('path')
var webpack = require('webpack')
var HtmlWebpackPlugin = require('html-webpack-plugin')
const VueLoaderPlugin = require('vue-loader/lib/plugin')
var path = require("path");
var webpack = require("webpack");
var HtmlWebpackPlugin = require("html-webpack-plugin");
const VueLoaderPlugin = require("vue-loader/lib/plugin");

module.exports = {
entry: './src/main.js',
entry: "./src/main.js",
output: {
path: path.resolve(__dirname, './dist'),
publicPath: 'dist/',
filename: 'build.js'
path: path.resolve(__dirname, "./dist"),
publicPath: "dist/",
filename: "build.js",
},
module: {
rules: [
{
test: /\.css$/,
use: [
'vue-style-loader',
'css-loader'
],
}, {
use: ["vue-style-loader", "css-loader"],
},
{
test: /\.vue$/,
loader: 'vue-loader',
loader: "vue-loader",
options: {
loaders: {
}
loaders: {},
// other vue-loader options go here
}
},
},
{
test: /\.js$/,
loader: 'babel-loader',
exclude: /node_modules/
loader: "babel-loader",
exclude: /node_modules/,
},
{
test: /\.(woff(2)?|ttf|eot|svg)(\?v=\d+\.\d+\.\d+)?$/,
loader: 'file-loader',
loader: "file-loader",
options: {
name: '[name].[ext]',
outputPath: 'fonts/'
}
name: "[name].[ext]",
outputPath: "fonts/",
},
},
{
test: /\.(png|jpg|gif|svg|mp3)$/,
loader: 'file-loader',
loader: "file-loader",
options: {
name: '[name].[ext]?[hash]'
}
}
]
name: "[name].[ext]?[hash]",
},
},
],
},
resolve: {
alias: {
'vue$': 'vue/dist/vue.esm.js'
vue$: "vue/dist/vue.esm.js",
},
extensions: ['*', '.js', '.vue', '.json']
extensions: ["*", ".js", ".vue", ".json"],
},
devServer: {
static: {
directory: path.join(__dirname, '/')
}
static: {
directory: path.join(__dirname, "/"),
},
},
performance: {
hints: false
hints: false,
},
devtool: 'eval-source-map',
devtool: "eval-source-map",
plugins: [
// make sure to include the plugin for the magic
new VueLoaderPlugin()
]
}
new VueLoaderPlugin(),
new HtmlWebpackPlugin({ template: "./index.html" }),
],
};

if (process.env.NODE_ENV === 'production') {
module.exports.devtool = 'source-map'
if (process.env.NODE_ENV === "production") {
module.exports.devtool = "source-map";
// http://vue-loader.vuejs.org/en/workflow/production.html
module.exports.plugins = (module.exports.plugins || []).concat([
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: '"production"'
}
}),
"process.env": {
NODE_ENV: '"production"',
},
}),
new webpack.LoaderOptionsPlugin({
minimize: true
}),
])
minimize: true,
}),
]);
}

0 comments on commit ddec568

Please sign in to comment.