Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

webpack config for working #16

Open
wants to merge 1 commit into
base: l25
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"main": "webpack.config.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "webpack",
"build-dev": "webpack --config-name dev-cfg",
"build-public": "webpack --config-name prod-cfg",
"clean-dev": "rm ./dev/ -r",
"clean-public": "rm ./public/ -r",
"server": "webpack server"
Expand Down
58 changes: 28 additions & 30 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
const path = require('path');
const MediaQueryPlugin = require('media-query-plugin');
const HtmlWebpackPlugin = require("html-webpack-plugin");
const {CleanWebpackPlugin} = require("clean-webpack-plugin");
const CopyWebpackPlugin = require("copy-webpack-plugin");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const CssMinimizerPlugin = require("css-minimizer-webpack-plugin");
Expand All @@ -12,9 +11,11 @@ module.exports =
{
entry: "./src/script/tailwind.config.js",
mode: "production",
name: "prod-cfg",
output: {
filename: "script/tailwind.config.js",
path: path.resolve(__dirname, "public"),
clean:true,
},
module: {
rules: [
Expand All @@ -38,6 +39,13 @@ module.exports =
name: "/pic/[name].[ext]",
}
},
{
test: /\.(eot|svg|ttf|woff|woff2|otf)$/,
type: "asset/resource",
generator: {
filename: "fonts/[hash][ext][query]"
}
},
]
},
optimization: {
Expand All @@ -48,7 +56,6 @@ module.exports =
minimize: true,
},
plugins:[
new CleanWebpackPlugin(),
new HtmlWebpackPlugin({
filename: "index.html",
template: "./src/index.html",
Expand All @@ -64,14 +71,16 @@ module.exports =
"screen and (min-width: 900px)": "desktop"
}
}),
],
]
},
{
entry: "./src/script/tailwind.config.js",
mode: "development",
name: "dev-cfg",
output: {
filename: "script/tailwind.config.js",
path: path.resolve(__dirname, "dev"),
clean:true,
},
module: {
rules: [
Expand All @@ -90,32 +99,21 @@ module.exports =
name: "/pic/[name].[ext]",
}
},
]
]},
plugins:[
new HtmlWebpackPlugin({
filename: "index.html",
template: "./src/index.html",
}),
],
devServer:
{
static: {
directory: path.join(__dirname, 'dev'),
},
compress: false,
open: "/",
port: 8080,
}
},
plugins:[
new CleanWebpackPlugin(),
/*
new CopyWebpackPlugin({
patterns: [
{from: "./src/pic/", to: "./pic"},
{from: "./src/css/", to: "./css"},
{from: "./src/fonts/", to: "./fonts"},
]

}),*/
new HtmlWebpackPlugin({
filename: "index.html",
template: "./src/index.html",
}),
],
devServer:
{
static: {
directory: path.join(__dirname, 'dev'),
},
compress: false,
open: "/",
port: 8080,
}
},
]