-
-
Notifications
You must be signed in to change notification settings - Fork 739
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
new(examples-app): add Webpack setup
- Loading branch information
Showing
4 changed files
with
813 additions
and
307 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
# Examples app | ||
|
||
This small app run the examples in DayPicker and can be used to test the library. | ||
|
||
The primary development and build tool is Vite, but there's also a Webpack setup to test how the library would work using Webpack. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
import HtmlWebpackPlugin from "html-webpack-plugin"; | ||
import path from "path"; | ||
import { fileURLToPath } from "url"; | ||
|
||
const __filename = fileURLToPath(import.meta.url); | ||
const __dirname = path.dirname(__filename); | ||
|
||
export default { | ||
entry: "./src/main.tsx", | ||
output: { | ||
path: path.resolve(__dirname, "dist"), | ||
filename: "[name].[contenthash].js", | ||
clean: true | ||
}, | ||
resolve: { | ||
extensions: [".tsx", ".ts", ".js", ".jsx"] | ||
}, | ||
optimization: { | ||
usedExports: true, | ||
minimize: true, | ||
splitChunks: { | ||
chunks: "all", | ||
minSize: 20000, | ||
minChunks: 1, | ||
cacheGroups: { | ||
vendor: { | ||
test: /[\\/]node_modules[\\/]/, | ||
name: "vendors", | ||
chunks: "all" | ||
} | ||
} | ||
} | ||
}, | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.(ts|tsx)$/, | ||
exclude: /node_modules/, | ||
use: { | ||
loader: "babel-loader", | ||
options: { | ||
presets: [ | ||
"@babel/preset-env", | ||
["@babel/preset-react", { runtime: "automatic" }], | ||
"@babel/preset-typescript" | ||
] | ||
} | ||
} | ||
}, | ||
{ | ||
test: /\.module\.css$/, | ||
use: [ | ||
"style-loader", | ||
{ | ||
loader: "css-loader", | ||
options: { | ||
modules: { | ||
localIdentName: "[name]__[local]--[hash:base64:5]" | ||
} | ||
} | ||
} | ||
] | ||
}, | ||
{ | ||
test: /\.css$/, | ||
exclude: /\.module\.css$/, | ||
use: ["style-loader", "css-loader"] | ||
} | ||
] | ||
}, | ||
plugins: [ | ||
new HtmlWebpackPlugin({ | ||
template: "./index.html" | ||
}) | ||
], | ||
devServer: { | ||
static: { | ||
directory: path.join(__dirname, "public") | ||
}, | ||
hot: true, | ||
port: 3000, | ||
open: true | ||
} | ||
}; |
Oops, something went wrong.