2018-12-12 23:08:38 +00:00
|
|
|
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.
|
2019-03-11 14:01:59 +00:00
|
|
|
* This path is also specified in stories/index.stories.less
|
|
|
|
* when importing '../../src/ui/index.less'.
|
2018-12-12 23:08:38 +00:00
|
|
|
*/
|
|
|
|
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({
|
2019-10-17 08:51:49 +00:00
|
|
|
mw: 'mw'
|
2018-12-12 23:08:38 +00:00
|
|
|
} )
|
|
|
|
]
|
|
|
|
};
|