2018-05-28 06:49:15 -05:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
const merge = require('webpack-merge');
|
|
|
|
const common = require('./webpack.common.js');
|
|
|
|
const path = require('path');
|
|
|
|
const webpack = require('webpack');
|
2018-10-31 07:23:05 -05:00
|
|
|
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
2018-05-28 06:49:15 -05:00
|
|
|
const HtmlWebpackHarddiskPlugin = require('html-webpack-harddisk-plugin');
|
|
|
|
const CleanWebpackPlugin = require('clean-webpack-plugin');
|
2019-01-09 04:33:08 -06:00
|
|
|
const IgnoreNotFoundExportPlugin = require("./IgnoreNotFoundExportPlugin.js");
|
2018-05-28 06:49:15 -05:00
|
|
|
|
|
|
|
module.exports = merge(common, {
|
|
|
|
entry: {
|
2018-10-31 07:23:05 -05:00
|
|
|
app: ['webpack-dev-server/client?http://localhost:3333', './public/app/dev.ts'],
|
2018-05-28 06:49:15 -05:00
|
|
|
},
|
|
|
|
|
|
|
|
output: {
|
|
|
|
path: path.resolve(__dirname, '../../public/build'),
|
|
|
|
filename: '[name].[hash].js',
|
2018-10-31 07:23:05 -05:00
|
|
|
publicPath: '/public/build/',
|
2018-07-25 09:16:33 -05:00
|
|
|
pathinfo: false,
|
2018-05-28 06:49:15 -05:00
|
|
|
},
|
|
|
|
|
|
|
|
resolve: {
|
2018-06-06 02:12:06 -05:00
|
|
|
extensions: ['.scss', '.ts', '.tsx', '.es6', '.js', '.json', '.svg', '.woff2', '.png', '.html'],
|
2018-05-28 06:49:15 -05:00
|
|
|
},
|
|
|
|
|
2018-05-28 10:38:09 -05:00
|
|
|
devtool: 'eval-source-map',
|
|
|
|
|
2018-05-28 06:49:15 -05:00
|
|
|
devServer: {
|
|
|
|
publicPath: '/public/build/',
|
|
|
|
hot: true,
|
|
|
|
port: 3333,
|
|
|
|
proxy: {
|
2018-10-31 07:23:05 -05:00
|
|
|
'!/public/build': 'http://localhost:3000',
|
|
|
|
},
|
2018-05-28 06:49:15 -05:00
|
|
|
},
|
|
|
|
|
2018-07-25 09:16:33 -05:00
|
|
|
optimization: {
|
|
|
|
removeAvailableModules: false,
|
|
|
|
removeEmptyChunks: false,
|
|
|
|
splitChunks: false,
|
|
|
|
},
|
|
|
|
|
2018-05-28 06:49:15 -05:00
|
|
|
module: {
|
|
|
|
rules: [
|
|
|
|
{
|
2018-11-01 08:03:02 -05:00
|
|
|
test: /\.tsx?$/,
|
2018-05-28 06:49:15 -05:00
|
|
|
exclude: /node_modules/,
|
2018-10-31 07:23:05 -05:00
|
|
|
use: [
|
|
|
|
{
|
|
|
|
loader: 'babel-loader',
|
|
|
|
options: {
|
|
|
|
cacheDirectory: true,
|
|
|
|
babelrc: false,
|
2018-12-03 09:32:50 -06:00
|
|
|
plugins: [
|
|
|
|
[require('@rtsao/plugin-proposal-class-properties'), { loose: true }],
|
|
|
|
'angularjs-annotate',
|
2019-03-13 07:25:38 -05:00
|
|
|
'@babel/plugin-syntax-dynamic-import', // needed for `() => import()` in routes.ts
|
2018-12-03 09:32:50 -06:00
|
|
|
'react-hot-loader/babel',
|
2018-10-29 06:18:41 -05:00
|
|
|
],
|
2018-12-03 09:32:50 -06:00
|
|
|
presets: [
|
|
|
|
[
|
|
|
|
'@babel/preset-env',
|
|
|
|
{
|
|
|
|
targets: { browsers: 'last 3 versions' },
|
|
|
|
useBuiltIns: 'entry',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
'@babel/preset-typescript',
|
|
|
|
'@babel/preset-react',
|
|
|
|
],
|
2018-10-31 07:23:05 -05:00
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
2018-05-28 06:49:15 -05:00
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.scss$/,
|
|
|
|
use: [
|
2018-10-31 07:23:05 -05:00
|
|
|
'style-loader', // creates style nodes from JS strings
|
|
|
|
'css-loader', // translates CSS into CommonJS
|
2018-11-23 08:01:36 -06:00
|
|
|
{
|
|
|
|
loader: 'postcss-loader',
|
|
|
|
options: {
|
|
|
|
config: { path: __dirname + '/postcss.config.js' },
|
|
|
|
},
|
|
|
|
},
|
2019-02-04 10:28:57 -06:00
|
|
|
{
|
2019-02-08 07:06:06 -06:00
|
|
|
loader: 'sass-loader'
|
2019-02-04 10:28:57 -06:00
|
|
|
}
|
2018-10-31 07:23:05 -05:00
|
|
|
],
|
2018-05-28 06:49:15 -05:00
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.(png|jpg|gif|ttf|eot|svg|woff(2)?)(\?[a-z0-9=&.]+)?$/,
|
2018-10-31 07:23:05 -05:00
|
|
|
loader: 'file-loader',
|
2018-05-28 06:49:15 -05:00
|
|
|
},
|
2018-10-31 07:23:05 -05:00
|
|
|
],
|
2018-05-28 06:49:15 -05:00
|
|
|
},
|
|
|
|
|
|
|
|
plugins: [
|
2019-03-12 15:52:22 -05:00
|
|
|
new CleanWebpackPlugin(),
|
2018-05-28 06:49:15 -05:00
|
|
|
new HtmlWebpackPlugin({
|
|
|
|
filename: path.resolve(__dirname, '../../public/views/index.html'),
|
2018-11-02 04:49:46 -05:00
|
|
|
template: path.resolve(__dirname, '../../public/views/index-template.html'),
|
2018-05-28 06:49:15 -05:00
|
|
|
inject: 'body',
|
2018-10-31 07:23:05 -05:00
|
|
|
alwaysWriteToDisk: true,
|
2018-05-28 06:49:15 -05:00
|
|
|
}),
|
|
|
|
new HtmlWebpackHarddiskPlugin(),
|
|
|
|
new webpack.NamedModulesPlugin(),
|
|
|
|
new webpack.HotModuleReplacementPlugin(),
|
|
|
|
new webpack.DefinePlugin({
|
2018-10-31 07:23:05 -05:00
|
|
|
GRAFANA_THEME: JSON.stringify(process.env.GRAFANA_THEME || 'dark'),
|
2018-05-28 06:49:15 -05:00
|
|
|
'process.env': {
|
2018-10-31 07:23:05 -05:00
|
|
|
NODE_ENV: JSON.stringify('development'),
|
|
|
|
},
|
2018-05-28 06:49:15 -05:00
|
|
|
}),
|
2019-01-09 04:33:08 -06:00
|
|
|
new IgnoreNotFoundExportPlugin(),
|
2018-10-31 07:23:05 -05:00
|
|
|
],
|
2018-05-28 06:49:15 -05:00
|
|
|
});
|