OpenDroneMap-WebODM/webpack.config.js

113 wiersze
2.6 KiB
JavaScript

const webpack = require('webpack');
let path = require("path");
let BundleTracker = require('webpack-bundle-tracker');
let MiniCssExtractPlugin = require("mini-css-extract-plugin");
let LiveReloadPlugin = require('webpack-livereload-plugin');
2016-10-08 16:35:22 +00:00
2023-09-18 20:50:28 +00:00
const mode = process.argv.indexOf("production") !== -1 ? "production" : "development";
console.log(`Webpack mode: ${mode}`);
2016-10-08 16:35:22 +00:00
module.exports = {
2023-09-18 20:50:28 +00:00
mode,
2016-10-08 16:35:22 +00:00
context: __dirname,
entry: {
main: ['./app/static/app/js/main.jsx'],
Console: ['./app/static/app/js/Console.jsx'],
Dashboard: ['./app/static/app/js/Dashboard.jsx'],
MapView: ['./app/static/app/js/MapView.jsx'],
ModelView: ['./app/static/app/js/ModelView.jsx']
},
2016-10-08 16:35:22 +00:00
output: {
path: path.join(__dirname, './app/static/app/bundles/'),
filename: "[name]-[hash].js",
publicPath: '/static/app/bundles/'
2016-10-08 16:35:22 +00:00
},
plugins: [
new LiveReloadPlugin({ appendScriptTag: true }),
new BundleTracker({
filename: 'webpack-stats.json',
path: path.join(__dirname, './'),
}),
new MiniCssExtractPlugin({
filename: "./css/[name]-[hash].css",
chunkFilename: "[id].css"
}),
2023-11-26 23:22:38 +00:00
new webpack.ProvidePlugin({
Buffer: ['buffer', 'Buffer'],
}),
2016-10-08 16:35:22 +00:00
],
module: {
2017-07-18 18:14:59 +00:00
rules: [
{
test: /\.jsx?$/,
exclude: /(node_modules|bower_components)/,
2017-07-18 18:14:59 +00:00
use: [
{
loader: 'babel-loader',
options: {
plugins: [
'@babel/syntax-class-properties',
'@babel/proposal-class-properties'
2017-07-18 18:14:59 +00:00
],
presets: [
'@babel/preset-env',
'@babel/preset-react'
]
2017-07-18 18:14:59 +00:00
}
}
],
},
{
2016-10-27 20:40:22 +00:00
test: /\.s?css$/,
use: [
MiniCssExtractPlugin.loader,
"css-loader",
"sass-loader",
]
},
{
test: /\.(png|jpg|jpeg|svg)/,
use: {
loader: 'url-loader',
options: {
limit: 100000,
},
},
2016-12-19 21:39:38 +00:00
},
{
// shaders
test: /\.(frag|vert|glsl)$/,
loader: 'raw-loader'
2016-10-08 16:35:22 +00:00
}
]
},
resolve: {
2017-07-18 18:14:59 +00:00
modules: ['node_modules', 'bower_components'],
extensions: ['.js', '.jsx'],
fallback: {
buffer: require.resolve('buffer'),
}
},
externals: {
2016-12-19 21:39:38 +00:00
// require("jquery") is external and available
// on the global let jQuery
2018-02-09 17:38:42 +00:00
"jquery": "jQuery",
"SystemJS": "SystemJS",
2020-06-04 16:34:34 +00:00
"THREE": "THREE",
2019-12-04 03:59:44 +00:00
"React": "React",
"ReactDOM": "ReactDOM"
2019-09-07 13:44:12 +00:00
},
watchOptions: {
2019-11-05 20:47:29 +00:00
ignored: ['node_modules', './**/*.py'],
2019-09-07 13:44:12 +00:00
aggregateTimeout: 300,
poll: 1000
2016-10-08 16:35:22 +00:00
}
}