Files
ohif-viewer/extensions/vtk/webpack.config.js
T

139 lines
3.3 KiB
JavaScript
Raw Normal View History

2019-08-06 23:56:44 -04:00
const path = require("path");
const webpack = require("webpack");
const autoprefixer = require("autoprefixer");
2019-07-11 13:12:37 -04:00
// const vtkHtmlRules = require('vtk.js/Utilities/config/dependency.js').webpack
// .core.rules;
// Optional if you want to load *.css and *.module.css files
// var cssRules = require('vtk.js/Utilities/config/dependency.js').webpack.css.rules;
2019-08-06 23:56:44 -04:00
const SRC_DIR = path.join(__dirname, "./src");
const OUTPUT_DIR = path.join(__dirname, "./dist");
module.exports = {
2019-08-06 23:56:44 -04:00
mode: "development",
2019-07-11 13:12:37 -04:00
entry: {
2019-08-06 23:56:44 -04:00
app: `${SRC_DIR}/index.js`
2019-07-11 13:12:37 -04:00
},
context: SRC_DIR,
// ~~~ MODE
output: {
path: OUTPUT_DIR,
2019-08-06 23:56:44 -04:00
library: "ohifVtkExtension",
libraryTarget: "umd",
filename: "index.umd.js",
auxiliaryComment: "Text VTK Extension Comment"
2019-07-11 13:12:37 -04:00
},
stats: {
colors: true,
hash: true,
timings: true,
assets: true,
chunks: true,
chunkModules: true,
modules: true,
children: true,
2019-08-06 23:56:44 -04:00
warnings: true
2019-07-11 13:12:37 -04:00
},
optimization: {
minimize: false,
2019-08-06 23:56:44 -04:00
sideEffects: true
2019-07-11 13:12:37 -04:00
},
// ~~~ END MODE
resolve: {
modules: [
2019-08-06 23:56:44 -04:00
path.resolve(__dirname, "node_modules"),
path.resolve(__dirname, "../../node_modules"),
SRC_DIR
2019-07-11 13:12:37 -04:00
],
2019-08-06 23:56:44 -04:00
extensions: [".js", ".jsx", ".json", "*"],
symlinks: true
},
module: {
rules: [
{
test: /\.(js|jsx)$/,
2019-07-11 13:12:37 -04:00
exclude: [/node_modules/],
2019-08-06 23:56:44 -04:00
loader: "babel-loader",
2019-07-05 22:58:25 -04:00
options: {
// Find babel.config.js in monorepo root
// https://babeljs.io/docs/en/options#rootmode
2019-08-06 23:56:44 -04:00
rootMode: "upward",
2019-07-05 22:58:25 -04:00
presets: [
[
2019-08-06 23:56:44 -04:00
"@babel/preset-env",
2019-07-05 22:58:25 -04:00
{
// Do not transform ES6 modules to another format.
// Webpack will take care of that.
2019-08-06 23:56:44 -04:00
modules: false
}
]
]
}
2019-07-05 22:58:25 -04:00
},
2019-07-11 13:12:37 -04:00
/**
*
*/
{
test: /\.css$/,
exclude: /\.module\.css$/,
use: [
2019-08-06 23:56:44 -04:00
"style-loader",
"css-loader",
2019-07-11 13:12:37 -04:00
{
2019-08-06 23:56:44 -04:00
loader: "postcss-loader",
2019-07-11 13:12:37 -04:00
options: {
2019-08-06 23:56:44 -04:00
plugins: () => [autoprefixer("last 2 version", "ie >= 10")]
}
}
]
2019-07-11 13:12:37 -04:00
},
/**
*
*/
{
test: /\.glsl$/i,
include: /vtk\.js[\/\\]Sources/,
2019-08-06 23:56:44 -04:00
loader: "shader-loader"
},
2019-07-11 13:12:37 -04:00
/**
*
*/
{
test: /\.worker\.js$/,
include: /vtk\.js[\/\\]Sources/,
use: [
{
2019-08-06 23:56:44 -04:00
loader: "worker-loader",
options: { inline: true, fallback: false }
}
]
}
]
}
2019-07-11 13:12:37 -04:00
// externals: [
// {
// cornerstone: {
// commonjs: 'cornerstone',
// commonjs2: 'cornerstone',
// amd: 'cornerstone',
// root: 'cornerstone',
// },
// 'cornerstone-math': {
// commonjs: 'cornerstone-math',
// commonjs2: 'cornerstone-math',
// amd: 'cornerstone-math',
// root: 'cornerstoneMath',
// },
// },
// '@ohif/i18n',
2019-08-06 23:56:44 -04:00
// '@ohif/core',
2019-07-11 13:12:37 -04:00
// 'dcmjs',
// 'react-viewerbase',
// 'react', //: 'React',
// 'react-dom', //: 'ReactDOM',
// 'react-redux', //: 'ReactRedux',
// 'react-resize-detector', //: 'ReactResizeDetector',
// 'react-viewerbase', //: 'reactViewerbase',
// 'prop-types', //: 'PropTypes'
// /*/\b(vtk.js)/*/
// ],
};