mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Popups
synced 2024-12-02 19:26:24 +00:00
76e02fae98
Notice how this actually reduces the size of the final, compiled index.js. It's not much, but still. One issue I noticed is that the coverage reports for the JS code stopped working. I have no idea why. Bug: T208951 Change-Id: I2fe92579574b3b1ba4d2dd064899eee944045a96
70 lines
1.3 KiB
JavaScript
70 lines
1.3 KiB
JavaScript
const path = require("path");
|
|
const webpack = require('webpack');
|
|
|
|
module.exports = {
|
|
module: {
|
|
rules: [ {
|
|
test: /\.less$/,
|
|
use: [{
|
|
loader: 'style-loader'
|
|
}, {
|
|
loader: 'css-loader'
|
|
}, {
|
|
loader: 'less-loader',
|
|
options: {
|
|
paths: [
|
|
/**
|
|
* Less files are resolved to this path,
|
|
* which contain less files that essentially
|
|
* just reach into mediawiki core fo the
|
|
* appropriate files.
|
|
* This path is also specified in stories/index.stories.less
|
|
* when importing '../../src/ui/index.less'.
|
|
*/
|
|
path.resolve(__dirname, './mocks/less')
|
|
]
|
|
}
|
|
}],
|
|
},
|
|
{
|
|
test: /\.svg$/,
|
|
issuer: /\.less$/,
|
|
loader: 'url-loader'
|
|
},
|
|
{
|
|
test: /\.svg$/,
|
|
loader: 'svg-inline-loader',
|
|
issuer: /\.js$/,
|
|
options: {
|
|
removeSVGTagAttrs: false // Keep width and height attributes.
|
|
}
|
|
},
|
|
{
|
|
test: require.resolve('jquery'),
|
|
use: [{
|
|
loader: 'expose-loader',
|
|
options: '$'
|
|
}]
|
|
},
|
|
{
|
|
test: require.resolve('./mocks/js/mockMediaWiki.js'),
|
|
use: [{
|
|
loader: 'expose-loader',
|
|
options: 'mw'
|
|
}]
|
|
}
|
|
]
|
|
},
|
|
resolve: {
|
|
alias: {
|
|
'mw': require.resolve('./mocks/js/mockMediaWiki.js')
|
|
},
|
|
extensions: [ '.js' ]
|
|
},
|
|
plugins: [
|
|
new webpack.ProvidePlugin({
|
|
mw: 'mw'
|
|
} )
|
|
]
|
|
};
|