openmct/webpack.config.js
Charles Hacskaylo fa66289d5c Misc UI 10 (#2441)
* Misc UI 10

- Add .c-input--sm CSS class for VISTA auto-clear input;

* Misc UI 10

- WIP!
- Add new glyohs: suitcase and clear data;
- Change icon-database to icon-suitcase;
- Need to unit test!

* Misc UI 10

- Refinements to shell__head Indicators layout;
- Refinements to collapse-buttons;
- Better color for Snow theme caution;

* Misc UI 10

- Better Open MCT logo for Snow theme;
- Renamed logo-app.svg to logo-openmct.svg;
- Removed unused image files;

* Misc UI 10

- Remove title attr from Angular indicator, interferes with hover
element;

* Misc UI 10

- Fix favicons, updated art;
- Removed favicon.ico;

* Misc UI 10

- Rebuild of Icomoon JSON file, which appeared to have gotten
damaged, probably due to merging;
- Font files updated, added .svg font back to repo;
- Font metrics modified to now use 20% baseline height;

* Misc UI 10

- Fix class in plot for control-bar element;
- Fix CSS in ObjectFrame.vue;

* Misc UI 10

- Rename folder styles-new to styles;

* Misc UI 10

- Remove unused src/fonts folder;

* Misc UI 10

- Symbols font now using baseline of 20%;
2019-08-30 15:51:52 -07:00

130 lines
4.1 KiB
JavaScript

const path = require('path');
const bourbon = require('node-bourbon');
const packageDefinition = require('./package.json');
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const CopyWebpackPlugin = require('copy-webpack-plugin');
const webpack = require('webpack');
const devMode = process.env.NODE_ENV !== 'production';
const VueLoaderPlugin = require('vue-loader/lib/plugin');
// TODO: Build Constants w/ git-rev-sync
const gitRevision = require('child_process')
.execSync('git rev-parse HEAD')
.toString().trim();
const gitBranch = require('child_process')
.execSync('git rev-parse --abbrev-ref HEAD')
.toString().trim();
const webpackConfig = {
mode: devMode ? 'development' : 'production',
entry: {
openmct: './openmct.js',
},
output: {
filename: '[name].js',
library: '[name]',
libraryTarget: 'umd',
path: path.resolve(__dirname, 'dist')
},
resolve: {
alias: {
"legacyRegistry": path.join(__dirname, "src/legacyRegistry"),
"saveAs": "file-saver",
"csv": "comma-separated-values",
"EventEmitter": "eventemitter3",
"bourbon": "bourbon.scss",
"vue": path.join(__dirname, "node_modules/vue/dist/vue.js"),
"d3-scale": path.join(__dirname, "node_modules/d3-scale/build/d3-scale.min.js"),
"printj": path.join(__dirname, "node_modules/printj/dist/printj.min.js"),
"styles": path.join(__dirname, "src/styles")
}
},
devtool: devMode ? 'eval-source-map' : 'source-map',
plugins: [
new webpack.DefinePlugin({
__OPENMCT_VERSION__: `'${packageDefinition.version}'`,
__OPENMCT_BUILD_DATE__: `'${new Date()}'`,
__OPENMCT_REVISION__: `'${gitRevision}'`,
__OPENMCT_BUILD_BRANCH__: `'${gitBranch}'`
}),
new VueLoaderPlugin(),
new MiniCssExtractPlugin({
path: 'assets/styles/',
filename: '[name].css'
}),
new CopyWebpackPlugin([
{
from: 'src/images/favicons',
to: 'favicons'
},
{
from: './index.html',
transform: function (content) {
return content.toString().replace(/dist\//g, '');
}
}
])
],
module: {
rules: [
{
test: /\.(sc|sa|c)ss$/,
use: [
devMode ? 'style-loader': MiniCssExtractPlugin.loader,
'css-loader',
{
loader: 'fast-sass-loader',
options: {
includePaths: bourbon.includePaths
}
}
]
},
{
test: /\.html$/,
use: 'html-loader'
},
{
test: /zepto/,
use: [
"imports-loader?this=>window",
"exports-loader?Zepto"
]
},
{
test: /\.(jpg|jpeg|png|svg|ico|woff2?|eot|ttf)$/,
loader: 'file-loader',
options: {
name: '[name].[ext]',
outputPath(url, resourcePath, context) {
if (/\.(jpg|jpeg|png|svg)$/.test(url)) {
return `images/${url}`
}
if (/\.ico$/.test(url)) {
return `icons/${url}`
}
if (/\.(woff2?|eot|ttf)$/.test(url)) {
return `fonts/${url}`
} else {
return `${url}`;
}
}
}
},
{
test: /\.vue$/,
use: 'vue-loader'
}
]
},
stats: {
modules: false,
timings: true,
colors: true,
warningsFilter: /asset size limit/g
}
};
module.exports = webpackConfig;