mirror of
https://github.com/chanzuckerberg/cellxgene.git
synced 2026-09-30 13:58:12 +08:00
Explicit Browser Support (#1682)
* add FastestSmallestTextEncoderDecoder polyfill * remove nomodule from script import * add browserslist * add obsolete-webpack-plugin * switch out modern-browser for preset-env * add prompt on non target browser * propagate prod changes to dev * add core-js-3 and TextEncoder TextDecoder (#1671) * add script to remove react, style html * propagate changes to prod * add script-ext-html-webpack-plugin for async * more styling * add eslint-plugin-compat * extend compat plugin * add existing polyfills * add github fetch polyfill * add AbortController polyfill * change promptOnNonTargetBrowser to false * propagate * add browser links * prettier * add browser support to readme * move polyfills to webpack * remove CDN encoder polyfill * Add no Explorer support * fix incorrect package name * propagate changes * Update README.md Co-authored-by: Ambrose J Carr <ambrosejcarr@users.noreply.github.com> * add new deps * create shared config * swap out html-loader for filestream * sanitize template Co-authored-by: Timmy Huang <tihuan@users.noreply.github.com> Co-authored-by: Ambrose J Carr <ambrosejcarr@users.noreply.github.com>
This commit is contained in:
co-authored by
Ambrose J Carr
Timmy Huang
parent
ce13a9c7ca
commit
8bbc183647
@@ -0,0 +1,74 @@
|
||||
const path = require("path");
|
||||
const fs = require("fs");
|
||||
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
|
||||
const ObsoleteWebpackPlugin = require("obsolete-webpack-plugin");
|
||||
const ScriptExtHtmlWebpackPlugin = require("script-ext-html-webpack-plugin");
|
||||
|
||||
const src = path.resolve("src");
|
||||
const nodeModules = path.resolve("node_modules");
|
||||
|
||||
const publicPath = "/";
|
||||
|
||||
const rawObsoleteHTMLTemplate = fs.readFileSync(
|
||||
`${__dirname}/obsoleteHTMLTemplate.html`,
|
||||
"utf8"
|
||||
);
|
||||
|
||||
const obsoleteHTMLTemplate = rawObsoleteHTMLTemplate.replace(/'/g, '"');
|
||||
|
||||
module.exports = {
|
||||
entry: [
|
||||
"core-js",
|
||||
"regenerator-runtime/runtime",
|
||||
"fastestsmallesttextencoderdecoder",
|
||||
"whatwg-fetch",
|
||||
"abort-controller/polyfill",
|
||||
"./src/index",
|
||||
],
|
||||
output: {
|
||||
path: path.resolve("build"),
|
||||
publicPath,
|
||||
},
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.css$/,
|
||||
include: src,
|
||||
exclude: [path.resolve(src, "index.css")],
|
||||
use: [
|
||||
MiniCssExtractPlugin.loader,
|
||||
{
|
||||
loader: "css-loader",
|
||||
options: {
|
||||
modules: {
|
||||
localIdentName: "[name]__[local]___[hash:base64:5]",
|
||||
},
|
||||
importLoaders: 1,
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
test: /index\.css$/,
|
||||
include: [path.resolve(src, "index.css")],
|
||||
use: [MiniCssExtractPlugin.loader, "css-loader"],
|
||||
},
|
||||
{
|
||||
test: /\.json$/,
|
||||
include: [src, nodeModules],
|
||||
loader: "json-loader",
|
||||
exclude: /manifest.json$/,
|
||||
},
|
||||
],
|
||||
},
|
||||
plugins: [
|
||||
new ObsoleteWebpackPlugin({
|
||||
name: "obsolete",
|
||||
template: obsoleteHTMLTemplate,
|
||||
promptOnNonTargetBrowser: false,
|
||||
}),
|
||||
new ScriptExtHtmlWebpackPlugin({
|
||||
async: "obsolete",
|
||||
}),
|
||||
],
|
||||
};
|
||||
Reference in New Issue
Block a user