mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
* Webpack 4 * webpack: force angular version 1.6 as 1.7 has removed a legacy feature toggle Grafana needs, switched from awesome-typescript-loader to ts-loader & forked ts checker * Webpack 4 * webpack: force angular version 1.6 as 1.7 has removed a legacy feature toggle Grafana needs, switched from awesome-typescript-loader to ts-loader & forked ts checker * upgrade ts loader * simplified splitChunks * upgrade circle node image to v8 * webpack: minor changes, using the new mode option, removed unused awesome-typescript loader, investigating karma issue but no solution yet * fix: change angular mocks version restriction to be more strict * add babel-loader for HMR support, fix karma debug runner * babel-loader to yarn.lock * webpack: changed from ExtractTextPlugin to MiniCssExtractPlugin, and updated the minification step to use new webpack4 optimization config section * webpack: remove css minifcation from general css processing as it's done in the webpack optimization step * limit vendors chunk to .ts and .js files * fix: removed typescript compile error, wanted to see if we still got test failure for that * tech: upgrade uglify-js, should be faster now
97 lines
2.4 KiB
JavaScript
97 lines
2.4 KiB
JavaScript
'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/",
|
|
},
|
|
|
|
resolve: {
|
|
extensions: ['.scss', '.ts', '.tsx', '.es6', '.js', '.json', '.svg', '.woff2', '.png', '.html'],
|
|
},
|
|
|
|
devtool: 'eval-source-map',
|
|
|
|
devServer: {
|
|
publicPath: '/public/build/',
|
|
hot: true,
|
|
port: 3333,
|
|
proxy: {
|
|
'!/public/build': 'http://localhost:3000'
|
|
}
|
|
},
|
|
|
|
module: {
|
|
rules: [
|
|
{
|
|
test: /\.tsx?$/,
|
|
exclude: /node_modules/,
|
|
use: [{
|
|
loader: 'babel-loader',
|
|
options: {
|
|
cacheDirectory: true,
|
|
babelrc: false,
|
|
plugins: [
|
|
'syntax-dynamic-import',
|
|
'react-hot-loader/babel'
|
|
]
|
|
}
|
|
},
|
|
{
|
|
loader: 'ts-loader',
|
|
options: {
|
|
transpileOnly: true
|
|
},
|
|
}],
|
|
},
|
|
{
|
|
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')
|
|
}
|
|
}),
|
|
]
|
|
});
|