influxdb/ui/webpack.common.ts

156 lines
3.9 KiB
TypeScript
Raw Normal View History

const path = require('path')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin')
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin')
const {CleanWebpackPlugin} = require('clean-webpack-plugin')
const webpack = require('webpack')
const {
GIT_SHA,
STATIC_DIRECTORY,
BASE_PATH,
API_BASE_PATH,
} = require('./src/utils/env')
module.exports = {
context: __dirname,
output: {
path: path.resolve(__dirname, 'build'),
publicPath: BASE_PATH,
webassemblyModuleFilename: `${STATIC_DIRECTORY}[modulehash:10].wasm`,
2020-02-20 17:58:56 +00:00
sourceMapFilename: `${STATIC_DIRECTORY}[file].map[query]`,
},
entry: {
app: './src/bootstrap.ts',
},
resolve: {
alias: {
src: path.resolve(__dirname, 'src'),
assets: path.resolve(__dirname, 'assets'),
react: path.resolve('./node_modules/react'),
},
extensions: ['.tsx', '.ts', '.js', '.wasm'],
},
node: {
fs: 'empty',
global: true,
crypto: 'empty',
tls: 'empty',
net: 'empty',
process: true,
module: false,
clearImmediate: false,
setImmediate: true,
},
module: {
rules: [
{
2020-03-18 22:41:08 +00:00
test: /flux_bg.wasm$/,
type: 'webassembly/experimental',
},
{
test: /^((?!flux_parser_bg|flux-lsp-browser_bg|flux_bg).)*.wasm$/,
loader: 'file-loader',
type: 'javascript/auto',
},
{
test: /\.tsx?$/,
use: [
{
loader: 'ts-loader',
options: {
transpileOnly: true,
},
},
],
},
{
test: /\.md$/,
use: [{loader: 'raw-loader'}],
},
{
test: /\.s?css$/i,
use: [
MiniCssExtractPlugin.loader,
'css-loader',
{
loader: 'sass-loader',
options: {
implementation: require('sass'),
hmr: true,
},
},
],
},
{
test: /\.(png|svg|jpg|gif)$/,
use: [
{
loader: 'file-loader',
options: {
name: `${STATIC_DIRECTORY}[contenthash:10].[ext]`,
},
},
],
},
{
test: /\.(woff|woff2|eot|ttf|otf)$/,
use: [
{
loader: 'file-loader',
options: {
name: `${STATIC_DIRECTORY}[contenthash:10].[ext]`,
},
},
],
},
],
},
plugins: [
new CleanWebpackPlugin(),
new HtmlWebpackPlugin({
filename: 'index.html',
template: './assets/index.html',
favicon: './assets/images/favicon.ico',
inject: 'body',
minify: {
collapseWhitespace: true,
removeComments: true,
removeRedundantAttributes: true,
removeScriptTypeAttributes: true,
removeStyleLinkTypeAttributes: true,
useShortDoctype: true,
},
base: BASE_PATH.slice(0, -1),
header: process.env.INJECT_HEADER || '',
body: process.env.INJECT_BODY || '',
}),
new MiniCssExtractPlugin({
filename: `${STATIC_DIRECTORY}[contenthash:10].css`,
chunkFilename: `${STATIC_DIRECTORY}[id].[contenthash:10].css`,
}),
new ForkTsCheckerWebpackPlugin(),
new webpack.ProgressPlugin(),
new webpack.EnvironmentPlugin({
...process.env,
GIT_SHA,
API_PREFIX: API_BASE_PATH,
STATIC_PREFIX: BASE_PATH,
}),
new MonacoWebpackPlugin({
2020-03-02 17:38:30 +00:00
languages: [],
features: ['!gotoSymbol'],
}),
],
stats: {
colors: true,
children: false,
modules: false,
version: false,
assetsSort: '!size',
style(clockface): upgrade to 0.0.18 (#14458) * Update dependency * Fix appearance of signin form * Fix appearance of inline label editor * Update implementation of dropdown * Remove comment * Fix appearance of auto refresh dropdown * Update implementation of time range dropdown * Update implementation of time zone dropdown * Update implementation of window selector * Fix missing button text in window selector Oooooops * Update implementation of time format dropdown * Update implementation of column selector * Update implementation of geometry dropdown * Ensure line graphs have a default color palette * Update implementation of color scheme dropdown * Update implementation of heat map color selector * Update dropdown implementations in histogram options * Update implementation of Variable Builder dropdowns * Update implementation of buckets dropdown * Tweak color of slide toggle in token row to be green * Update implementation of Generate Token dropdown * Update snapshot tests * Update bucket dropdown tests * Fix query builder test * Update onboarding buttons test * Fix some e2e tests * Fix tokens e2e tests * Fix variables e2e tests * Update implemenation of view type dropdown Also removing the empty view type from existence Co-Authored-By: Christopher Henn <chnn@users.noreply.github.com> * Fix query builder add card button Made it less prone to breakage * Fix appearance of VEO * Update styles of renamable page title * Update styles using button or icon or input * Ensure time range dropdown is not blank initially * Update implementation of variable tooltip dropdown * Update implementation of dropdowns in Add Members form * Update implementation of Color dropdown * Update implementation of dropdowns in scatter plot options * Upddate implementation of precision dropdown * Update implementation of sort by table option dropdown * Update implementation of dashboards dropdown in save as menu * Update implementations of dropdowns in task form * Update Variable control bar dropdowns * Delete unused component * Remove unused imports * Update bucket dropdown implementation in delete data form * Update searchable dropdown to use new clockface components * Delete local dropdown components * Fix failing unit tests * blerp * Coerce type in view type dropdown * Fix onboarding styles * Fix e2e tests Co-Authored-By: Andrew Watkins <121watts@users.noreply.github.com> * Fix last e2e test Co-Authored-By: Andrew Watkins <121watts@users.noreply.github.com> * build(e2e): allow cypress to run with webpack dev server
2019-07-25 19:13:51 +00:00
warningsFilter: [/export .* was not found in/, /'.\/locale' in/],
excludeAssets: [/\.(hot-update|woff|eot|ttf|svg|ico|png)/],
},
performance: {hints: false},
}