Doodle3D-Slicer/webpack.config.js

75 lines
1.8 KiB
JavaScript
Raw 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 devMode = true;
2017-07-20 12:12:25 +02:00
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-11-16 22:40:39 +01:00
'doodle3d-slicer': path.resolve(__dirname, 'src/'),
2017-07-24 17:47:03 +02:00
'clipper-lib': '@doodle3d/clipper-lib',
'clipper-js': '@doodle3d/clipper-js',
'doodle3d-core': `@doodle3d/doodle3d-core/${devMode ? 'module' : 'lib'}`,
'cal': '@doodle3d/cal'
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]
}, {
test: /\.(png|jpg|gif)$/,
use: ['url-loader?name=images/[name].[ext]']
2017-12-06 11:54:09 +01:00
}, {
test: /\.glsl$/,
use: ['raw-loader']
2017-07-20 12:12:25 +02:00
}
]
},
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'
}
};