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');
|
|
|
|
const HtmlWebpackPlugin = require("html-webpack-plugin");
|
|
|
|
const HtmlWebpackHarddiskPlugin = require('html-webpack-harddisk-plugin');
|
|
|
|
const CleanWebpackPlugin = require('clean-webpack-plugin');
|
|
|
|
|
|
|
|
module.exports = merge(common, {
|
|
|
|
entry: {
|
|
|
|
app: [
|
|
|
|
'webpack-dev-server/client?http://localhost:3333',
|
|
|
|
'./public/app/dev.ts',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
|
|
|
|
output: {
|
|
|
|
path: path.resolve(__dirname, '../../public/build'),
|
|
|
|
filename: '[name].[hash].js',
|
|
|
|
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: {
|
|
|
|
'!/public/build': 'http://localhost:3000'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
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: [
|
|
|
|
{
|
|
|
|
test: /\.tsx?$/,
|
|
|
|
exclude: /node_modules/,
|
2018-06-26 03:28:37 -05:00
|
|
|
use: [{
|
|
|
|
loader: 'babel-loader',
|
2018-05-28 06:49:15 -05:00
|
|
|
options: {
|
2018-06-26 03:28:37 -05:00
|
|
|
cacheDirectory: true,
|
|
|
|
babelrc: false,
|
|
|
|
plugins: [
|
|
|
|
'syntax-dynamic-import',
|
|
|
|
'react-hot-loader/babel'
|
|
|
|
]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
loader: 'ts-loader',
|
|
|
|
options: {
|
2018-07-25 09:16:33 -05:00
|
|
|
transpileOnly: true,
|
|
|
|
experimentalWatchApi: true
|
2018-05-28 06:49:15 -05:00
|
|
|
},
|
2018-06-26 03:28:37 -05:00
|
|
|
}],
|
2018-05-28 06:49:15 -05:00
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.scss$/,
|
|
|
|
use: [
|
|
|
|
"style-loader", // creates style nodes from JS strings
|
|
|
|
"css-loader", // translates CSS into CommonJS
|
|
|
|
"sass-loader" // compiles Sass to CSS
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.(png|jpg|gif|ttf|eot|svg|woff(2)?)(\?[a-z0-9=&.]+)?$/,
|
|
|
|
loader: 'file-loader'
|
|
|
|
},
|
|
|
|
]
|
|
|
|
},
|
|
|
|
|
|
|
|
plugins: [
|
|
|
|
new CleanWebpackPlugin('../public/build', { allowExternal: true }),
|
|
|
|
new HtmlWebpackPlugin({
|
|
|
|
filename: path.resolve(__dirname, '../../public/views/index.html'),
|
|
|
|
template: path.resolve(__dirname, '../../public/views/index.template.html'),
|
|
|
|
inject: 'body',
|
|
|
|
alwaysWriteToDisk: true
|
|
|
|
}),
|
|
|
|
new HtmlWebpackHarddiskPlugin(),
|
|
|
|
new webpack.NamedModulesPlugin(),
|
|
|
|
new webpack.HotModuleReplacementPlugin(),
|
|
|
|
new webpack.DefinePlugin({
|
|
|
|
'GRAFANA_THEME': JSON.stringify(process.env.GRAFANA_THEME || 'dark'),
|
|
|
|
'process.env': {
|
|
|
|
'NODE_ENV': JSON.stringify('development')
|
|
|
|
}
|
|
|
|
}),
|
|
|
|
]
|
|
|
|
});
|