Skip to content

Commit

Permalink
modified
Browse files Browse the repository at this point in the history
  • Loading branch information
011015 committed May 21, 2024
1 parent 722fc4b commit 86a2a91
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 63 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ jobs:
- name: Install and Build
run: |
npm install
npm run experience
npm run experiment
- name: Deploy github pages
uses: JamesIves/github-pages-deploy-action@v4.4.3
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: gh-pages
folder: experience
folder: experiment
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/experience
/experiment
/dist
/node_modules
index.html
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "A React pop-up component library",
"main": "dist/index.min.js",
"scripts": {
"experience": "webpack --mode=production --config webpack.dev.js",
"experiment": "webpack --mode=production --config webpack.dev.js",
"build": "webpack --mode=production --config webpack.prod.js",
"dev": "webpack-dev-server --open --mode=development --config webpack.dev.js",
"release": "npm run build && npm publish"
Expand Down
117 changes: 58 additions & 59 deletions webpack.dev.js
Original file line number Diff line number Diff line change
@@ -1,64 +1,63 @@
const path = require('path')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
const CssMinimizerWebpackPlugin = require('css-minimizer-webpack-plugin')
const path = require("path");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const CssMinimizerWebpackPlugin = require("css-minimizer-webpack-plugin");

const config = {
entry: path.resolve(__dirname, 'src/index.js'),
output: {
path: path.resolve(__dirname, 'experience'),
filename: 'index.js',
clean: true,
},
devtool: 'source-map',
devServer: {
static: path.resolve(__dirname),
hot: true,
},
plugins: [
new HtmlWebpackPlugin({
template: path.resolve(__dirname, 'public/index.html'),
filename: path.resolve(__dirname, 'experience/index.html')
}),
new MiniCssExtractPlugin({
filename: './index.css'
})
],
module: {
rules: [
{
test: /\.css$/i,
use: [MiniCssExtractPlugin.loader, 'css-loader'],
entry: path.resolve(__dirname, "src/index.js"),
output: {
path: path.resolve(__dirname, "experiment"),
filename: "index.js",
clean: true,
},
devtool: "source-map",
devServer: {
static: path.resolve(__dirname),
hot: true,
},
plugins: [
new HtmlWebpackPlugin({
template: path.resolve(__dirname, "public/index.html"),
filename: path.resolve(__dirname, "experiment/index.html"),
}),
new MiniCssExtractPlugin({
filename: "./index.css",
}),
],
module: {
rules: [
{
test: /\.css$/i,
use: [MiniCssExtractPlugin.loader, "css-loader"],
},
{
test: /\.jsx?$/i,
use: [
{
loader: "babel-loader",
options: {
presets: ["@babel/preset-env", "@babel/preset-react"],
},
{
test: /\.jsx?$/i,
use: [{
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env', '@babel/preset-react'],
}
}]
},
{
test: /\.(png|jpg|jpeg|gif)$/i,
type: 'asset',
generator: {
filename: 'assets/[hash][ext][query]'
}
}
]
},
resolve: {
alias: {
'@components': path.resolve(__dirname, 'src/components'),
}
},
],
},
{
test: /\.(png|jpg|jpeg|gif)$/i,
type: "asset",
generator: {
filename: "assets/[hash][ext][query]",
},
},
],
},
resolve: {
alias: {
"@components": path.resolve(__dirname, "src/components"),
},
optimization: {
minimizer: [
`...`,
new CssMinimizerWebpackPlugin(),
]
}
}
},
optimization: {
minimizer: [`...`, new CssMinimizerWebpackPlugin()],
},
};

module.exports = config;
module.exports = config;

0 comments on commit 86a2a91

Please sign in to comment.