mirror of
https://github.com/chanzuckerberg/cellxgene.git
synced 2026-09-17 05:47:58 +08:00
This seems to fix the font URL path, at least locally for both `:3000` and `:5005` <img width="1296" alt="Screen Shot 2020-08-24 at 4 01 07 PM" src="https://user-images.githubusercontent.com/6309723/91106044-8a338780-e626-11ea-885f-e5c268f3ecf0.png"> <img width="1377" alt="Screen Shot 2020-08-24 at 4 01 28 PM" src="https://user-images.githubusercontent.com/6309723/91106047-8dc70e80-e626-11ea-95b0-62e47cc6303f.png">
97 lines
2.5 KiB
JavaScript
97 lines
2.5 KiB
JavaScript
const path = require("path");
|
|
const HtmlWebpackPlugin = require("html-webpack-plugin");
|
|
const { CleanWebpackPlugin } = require("clean-webpack-plugin");
|
|
const TerserJSPlugin = require("terser-webpack-plugin");
|
|
const CleanCss = require("clean-css");
|
|
const OptimizeCSSAssetsPlugin = require("optimize-css-assets-webpack-plugin");
|
|
const FaviconsWebpackPlugin = require("favicons-webpack-plugin");
|
|
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
|
|
|
|
const { merge } = require("webpack-merge");
|
|
|
|
const babelOptions = require("../babel/babel.prod");
|
|
|
|
const CspHashPlugin = require("./cspHashPlugin");
|
|
const sharedConfig = require("./webpack.config.shared");
|
|
|
|
const fonts = path.resolve("src/fonts");
|
|
const nodeModules = path.resolve("node_modules");
|
|
|
|
const prodConfig = {
|
|
mode: "production",
|
|
bail: true,
|
|
cache: false,
|
|
output: {
|
|
filename: "static/[name]-[contenthash].js",
|
|
},
|
|
optimization: {
|
|
minimize: true,
|
|
minimizer: [
|
|
new TerserJSPlugin({}),
|
|
new OptimizeCSSAssetsPlugin({
|
|
cssProcessor: CleanCss,
|
|
}),
|
|
],
|
|
},
|
|
devtool: "source-map",
|
|
module: {
|
|
rules: [
|
|
{
|
|
test: /\.jsx?$/,
|
|
loader: "babel-loader",
|
|
options: babelOptions,
|
|
},
|
|
{
|
|
test: /\.(jpg|png|gif|eot|svg|ttf|woff|woff2|otf)$/i,
|
|
loader: "file-loader",
|
|
include: [nodeModules, fonts],
|
|
query: {
|
|
name: "static/assets/[name]-[contenthash].[ext]",
|
|
// (thuang): This is needed to make sure @font url path is '../static/assets/'
|
|
publicPath: "static/",
|
|
},
|
|
},
|
|
],
|
|
},
|
|
plugins: [
|
|
new HtmlWebpackPlugin({
|
|
filename: "index.html",
|
|
template: path.resolve("index_template.html"),
|
|
decodeEntities: false,
|
|
minify: false,
|
|
}),
|
|
new CleanWebpackPlugin({
|
|
verbose: true,
|
|
protectWebpackAssets: false,
|
|
cleanAfterEveryBuildPatterns: ["main.js", "main.css"],
|
|
}),
|
|
new FaviconsWebpackPlugin({
|
|
logo: "./favicon.png",
|
|
prefix: "static/assets/",
|
|
favicons: {
|
|
icons: {
|
|
android: false,
|
|
appleIcon: false,
|
|
appleStartup: false,
|
|
coast: false,
|
|
firefox: false,
|
|
windows: false,
|
|
yandex: false,
|
|
},
|
|
},
|
|
}),
|
|
new MiniCssExtractPlugin({
|
|
filename: "static/[name]-[contenthash].css",
|
|
}),
|
|
new CspHashPlugin({
|
|
filename: "csp-hashes.json",
|
|
}),
|
|
],
|
|
performance: {
|
|
maxEntrypointSize: 2000000,
|
|
maxAssetSize: 2000000,
|
|
},
|
|
};
|
|
|
|
module.exports = merge(sharedConfig, prodConfig);
|