Skip to content

Instantly share code, notes, and snippets.

@Kamilius
Created February 14, 2017 08:37
Show Gist options
  • Save Kamilius/6e4e69b75a9cc00984d6af06048addfe to your computer and use it in GitHub Desktop.
Save Kamilius/6e4e69b75a9cc00984d6af06048addfe to your computer and use it in GitHub Desktop.
/* eslint no-var: 0 */
var path = require('path');
var webpack = require('webpack');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
var StyleLintPlugin = require('stylelint-webpack-plugin');
module.exports = {
context: path.join(__dirname, 'app'),
entry: {
main: ['babel-polyfill', './src/app.js'],
},
devtool: 'eval-source-map',
target: 'web',
output: {
publicPath: '/',
path: path.join(__dirname, 'dist'),
filename: '[name]-[hash].js',
},
resolve: {
extensions: ['.js'],
alias: {
highcharts: 'highstock-release/highstock.src',
'highcharts-adapter': 'highstock-release/adapters/standalone-framework.src',
},
},
module: {
rules: [
{
test: require.resolve('highstock-release/adapters/standalone-framework.src'),
// loader: 'expose?HighchartsAdapter!exports?HighchartsAdapter',
use: [
{
loader: 'expose-loader',
query: 'HighchartsAdapter',
},
{
loader: 'exports-loader',
query: 'HighchartsAdapter',
},
],
},
{
test: require.resolve('highstock-release/highstock.src'),
// loader: 'exports?Highcharts!imports?HighchartsAdapter=highcharts-adapter'
use: [
{
loader: 'exports-loader',
query: 'Highcharts',
},
{
loader: 'imports-loader',
options: {
HighchartsAdapter: 'highcharts-adapter',
},
},
],
},
],
},
plugins: [
new webpack.LoaderOptionsPlugin({
debug: true,
}),
new webpack.NoEmitOnErrorsPlugin(),
new HtmlWebpackPlugin({
template: '!!handlebars-loader!app/resources/index.tpl.html',
favicon: 'resources/favicon.ico',
inject: false,
}),
new StyleLintPlugin({
configFile: '.stylelintrc.json',
}),
],
devServer: {
port: 9000,
},
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment