2018-03-19 20:46:28 +00:00
|
|
|
// Magic to include node_modules of root WebODM's directory
|
2020-03-31 18:02:19 +00:00
|
|
|
const fs = require('fs');
|
|
|
|
let webodmRoot = "../../../"; // Assuming plugins/<name>/public
|
|
|
|
if (!fs.existsSync(webodmRoot + "webodm.sh")) webodmRoot = "../../../../../"; // Assuming app/media/plugins/<name>/public
|
|
|
|
process.env.NODE_PATH = webodmRoot + "node_modules";
|
2018-03-19 20:46:28 +00:00
|
|
|
require("module").Module._initPaths();
|
|
|
|
|
|
|
|
let path = require("path");
|
|
|
|
let ExtractTextPlugin = require('extract-text-webpack-plugin');
|
|
|
|
|
|
|
|
module.exports = {
|
2018-07-25 20:42:56 +00:00
|
|
|
mode: 'production',
|
2018-03-19 20:46:28 +00:00
|
|
|
context: __dirname,
|
|
|
|
|
2018-07-26 19:14:48 +00:00
|
|
|
entry: ${entry_json},
|
2018-03-19 20:46:28 +00:00
|
|
|
|
|
|
|
output: {
|
|
|
|
path: path.join(__dirname, './build'),
|
|
|
|
filename: "[name].js",
|
|
|
|
libraryTarget: "amd"
|
|
|
|
},
|
|
|
|
|
|
|
|
plugins: [
|
2018-03-27 18:35:16 +00:00
|
|
|
new ExtractTextPlugin('[name].css', {
|
2018-03-19 20:46:28 +00:00
|
|
|
allChunks: true
|
|
|
|
})
|
|
|
|
],
|
|
|
|
|
|
|
|
module: {
|
|
|
|
rules: [
|
2018-07-25 20:42:56 +00:00
|
|
|
{
|
2018-07-26 19:14:48 +00:00
|
|
|
test: /\.jsx?$$/,
|
2018-07-25 20:42:56 +00:00
|
|
|
exclude: /(node_modules|bower_components)/,
|
2018-03-19 20:46:28 +00:00
|
|
|
use: [
|
|
|
|
{
|
|
|
|
loader: 'babel-loader',
|
|
|
|
query: {
|
2018-07-25 20:42:56 +00:00
|
|
|
plugins: [
|
|
|
|
'@babel/syntax-class-properties',
|
|
|
|
'@babel/proposal-class-properties'
|
2018-03-19 20:46:28 +00:00
|
|
|
],
|
2018-07-25 20:42:56 +00:00
|
|
|
presets: [
|
|
|
|
'@babel/preset-env',
|
|
|
|
'@babel/preset-react'
|
|
|
|
]
|
2018-03-19 20:46:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
2018-07-26 19:14:48 +00:00
|
|
|
test: /\.s?css$$/,
|
2018-03-19 20:46:28 +00:00
|
|
|
use: ExtractTextPlugin.extract({
|
2019-07-19 02:20:39 +00:00
|
|
|
use: [
|
|
|
|
{ loader: 'css-loader' },
|
|
|
|
{
|
|
|
|
loader: 'sass-loader',
|
|
|
|
options: {
|
|
|
|
implementation: require("sass")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
2018-03-19 20:46:28 +00:00
|
|
|
})
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.(png|jpg|jpeg|svg)/,
|
|
|
|
loader: "url-loader?limit=100000"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
|
|
|
|
resolve: {
|
|
|
|
modules: ['node_modules', 'bower_components'],
|
2018-07-27 18:18:03 +00:00
|
|
|
extensions: ['.js', '.jsx'],
|
|
|
|
alias: {
|
2020-03-31 18:02:19 +00:00
|
|
|
webodm: path.resolve(__dirname, webodmRoot + 'app/static/app/js')
|
2018-07-27 18:18:03 +00:00
|
|
|
}
|
2018-03-19 20:46:28 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
externals: {
|
|
|
|
// require("jquery") is external and available
|
|
|
|
// on the global let jQuery
|
|
|
|
"jquery": "jQuery",
|
|
|
|
"SystemJS": "SystemJS",
|
2018-03-27 18:35:16 +00:00
|
|
|
"PluginsAPI": "PluginsAPI",
|
2018-03-29 18:25:20 +00:00
|
|
|
"leaflet": "leaflet",
|
2019-12-04 03:59:44 +00:00
|
|
|
"ReactDOM": "ReactDOM",
|
2020-12-15 20:56:00 +00:00
|
|
|
"React": "React"
|
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
|
2018-03-19 20:46:28 +00:00
|
|
|
}
|
|
|
|
}
|