grafana/scripts/webpack/webpack.common.js
David ed067e8d35 Fix CSS asset loading for yarn start (HMR) (#11855)
* enable url() processing in CSS to ensure assets load in HMR mode
* only needed when running `yarn start` which needs this for the hot
reloader
2018-05-07 17:02:55 +02:00

67 lines
1.4 KiB
JavaScript

const path = require('path');
const { CheckerPlugin } = require('awesome-typescript-loader');
module.exports = {
target: 'web',
stats: {
children: false
},
entry: {
app: './public/app/index.ts',
},
output: {
path: path.resolve(__dirname, '../../public/build'),
filename: '[name].[hash].js',
// Keep publicPath relative for host.com/grafana/ deployments
publicPath: "public/build/",
},
resolve: {
extensions: ['.ts', '.tsx', '.es6', '.js', '.json'],
alias: {
},
modules: [
path.resolve('public'),
path.resolve('node_modules')
],
},
node: {
fs: 'empty',
},
module: {
rules: [
{
test: require.resolve('jquery'),
use: [
{
loader: 'expose-loader',
query: 'jQuery'
},
{
loader: 'expose-loader',
query: '$'
}
]
},
{
test: /\.html$/,
exclude: /index\.template.html/,
use: [
{ loader: 'ngtemplate-loader?relativeTo=' + (path.resolve(__dirname, '../../public')) + '&prefix=public' },
{
loader: 'html-loader',
options: {
attrs: [],
minimize: true,
removeComments: false,
collapseWhitespace: false
}
}
]
}
]
},
plugins: [
new CheckerPlugin(),
]
};