Files
cellxgene/client/configuration/webpack/webpack.config.shared.js
Severiano Badajoz 8bbc183647 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>
2020-08-03 12:50:09 -07:00

75 lines
1.8 KiB
JavaScript

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",
}),
],
};