Files
PLSmartPivot/webpack.config.js
Albert Backenhof 141be3f962 Aligned build to Dashboard bundle extensions build
-Part of the work to streamline how the extensions
 are handled, irregardless of what bundle.

Issue: DEB-130, DEB-133
2019-03-27 09:53:09 +01:00

79 lines
1.6 KiB
JavaScript

const StyleLintPlugin = require('stylelint-webpack-plugin');
const packageJSON = require('./package.json');
const path = require('path');
const DIST = path.resolve("./dist");
const MODE = process.env.NODE_ENV || 'development';
console.log('Webpack mode:', MODE); // eslint-disable-line no-console
const config = {
devtool: 'source-map',
entry: ['./src/index.js'],
externals: {
jquery: {
amd: 'jquery',
commonjs: 'jquery',
commonjs2: 'jquery',
root: '_'
},
qlik: {
amd: 'qlik',
commonjs: 'qlik',
commonjs2: 'qlik',
root: '_'
}
},
mode: MODE,
module: {
rules: [
{
enforce: 'pre',
exclude: /(node_modules|Library)/,
loader: 'eslint-loader',
options: {
failOnError: true
},
test: /\.(js|jsx)$/
},
{
exclude: /node_modules/,
test: /\.(js|jsx)$/,
use: {
loader: 'babel-loader',
options: {
plugins: [
'@babel/plugin-transform-async-to-generator',
'@babel/plugin-proposal-class-properties'
],
presets: [
'@babel/preset-env',
'@babel/preset-react'
]
}
}
},
{
test: /.less$/,
use: [
'style-loader',
'css-loader',
'less-loader'
]
}
]
},
output: {
filename: `${packageJSON.name}.js`,
libraryTarget: 'amd',
path: DIST
},
plugins: [
new StyleLintPlugin({
files: '**/*.less'
})
]
};
module.exports = config;