Doodle3D-Slicer/example/webpack.config.js

65 lines
1.5 KiB
JavaScript
Raw Permalink Normal View History

2017-07-20 12:12:25 +02:00
const path = require('path');
// const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
const HTMLWebpackPlugin = require('html-webpack-plugin');
const babelLoader = {
loader: 'babel-loader',
options: {
presets: [
2017-11-11 20:23:45 +01:00
require('babel-preset-env'),
require('babel-preset-react')
],
plugins: [
require('babel-plugin-transform-object-rest-spread'),
require('babel-plugin-transform-class-properties'),
require('babel-plugin-transform-runtime')
2017-07-20 12:12:25 +02:00
],
2017-07-20 16:14:01 +02:00
babelrc: false
2017-07-20 12:12:25 +02:00
}
2017-11-11 20:23:45 +01:00
};
2017-07-20 12:12:25 +02:00
module.exports = {
entry: './index.js',
output: {
filename: 'bundle.js',
path: path.resolve(__dirname, 'dist')
},
resolve: {
alias: {
2017-07-24 17:47:03 +02:00
'doodle3d-slicer': path.resolve(__dirname, '../src/index.js'),
'clipper-lib': '@doodle3d/clipper-lib',
'clipper-js': '@doodle3d/clipper-js'
2017-07-20 12:12:25 +02:00
}
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: babelLoader
2017-11-11 20:23:45 +01:00
}, { // make THREE global available to three.js examples
test: /three\/examples\/.+\.js/,
use: 'imports-loader?THREE=three'
}, {
2017-07-20 12:12:25 +02:00
test: /\.yml$/,
2017-07-20 16:58:42 +02:00
use: 'yml-loader'
2017-11-11 20:23:45 +01:00
}, {
2017-07-20 12:12:25 +02:00
test: /\.worker\.js$/,
use: ['worker-loader', babelLoader]
}
]
},
plugins: [
new HTMLWebpackPlugin({
2017-11-11 20:23:45 +01:00
title: 'Doodle3D Slicer - Simple example',
template: require('html-webpack-template'),
inject: false,
appMountId: 'app'
2017-07-20 12:12:25 +02:00
}),
],
devtool: "source-map",
devServer: {
contentBase: 'dist'
}
};