-
-
Save amritapatra-bg/c23f423d8ecb4039bc046f541b060910 to your computer and use it in GitHub Desktop.
Config files and entry files for map app using arcGI/webpack-plugin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@import '@arcgis/core/assets/esri/themes/light/main.css'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import EsriConfig from '@arcgis/core/config.js'; | |
import WebMap from '@arcgis/core/WebMap.js'; | |
import MapView from '@arcgis/core/views/MapView.js'; | |
import IdentityManager from '@arcgis/core/identity/IdentityManager.js'; | |
import BasemapGallery from '@arcgis/core/widgets/BasemapGallery.js'; | |
import LayerList from '@arcgis/core/widgets/LayerList.js'; | |
import Expand from '@arcgis/core/widgets/Expand.js'; | |
import Search from '@arcgis/core/widgets/Search.js'; | |
import Home from '@arcgis/core/widgets/Home.js'; | |
import Locate from '@arcgis/core/widgets/Locate.js'; | |
import ScaleBar from '@arcgis/core/widgets/ScaleBar.js'; | |
import Sketch from '@arcgis/core/widgets/Sketch.js'; | |
import SketchViewModel from '@arcgis/core/widgets/Sketch/SketchViewModel.js'; | |
import Graphic from '@arcgis/core/Graphic.js'; | |
import GraphicsLayer from '@arcgis/core/layers/GraphicsLayer.js'; | |
import geometryEngine from '@arcgis/core/geometry/geometryEngine.js'; | |
import { defineCustomElements as calciteComponents } from '@esri/calcite-components/dist/loader'; | |
calciteComponents(window, { | |
resourcesUrl: '/resource/clariti__CalciteAssets/' | |
}); | |
window.arcGISCore = (function () { | |
return { | |
EsriConfig: EsriConfig, | |
IdentityManager: IdentityManager, | |
WebMap: WebMap, | |
MapView: MapView, | |
BasemapGallery: BasemapGallery, | |
LayerList: LayerList, | |
Expand: Expand, | |
Search: Search, | |
Home: Home, | |
Locate: Locate, | |
ScaleBar: ScaleBar, | |
Sketch: Sketch, | |
SketchViewModel: SketchViewModel, | |
Graphic: Graphic, | |
GraphicsLayer: GraphicsLayer, | |
geometryEngine: geometryEngine | |
}; | |
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"private": true, | |
"scripts": { | |
"build": "webpack --progress --config ./webpack.config.js", | |
"watch": "webpack -w", | |
"start": "webpack serve --mode development" | |
}, | |
"devDependencies": { | |
"@babel/core": "^7.14.8", | |
"@babel/preset-env": "^7.14.8", | |
"babel-loader": "^8.2.2", | |
"copy-webpack-plugin": "^11.0.0", | |
"css-loader": "^6.8.1", | |
"mini-css-extract-plugin": "^2.7.6", | |
"source-map-loader": "^4.0.1", | |
"static-resource-webpack-plugin": "^1.0.1", | |
"webpack": "^5.85.0", | |
"webpack-cli": "^5.1.1", | |
"webpack-dev-server": "^4.15.0", | |
"xml-js": "^1.6.11" | |
}, | |
"dependencies": { | |
"@arcgis/core": "^4.28.10", | |
"@arcgis/webpack-plugin": "^4.22.0", | |
"@esri/calcite-components": "^2.1.0" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const path = require('path'); | |
const miniCssExtractPlugin = require('mini-css-extract-plugin'); | |
const arcGISPlugin = require('@arcgis/webpack-plugin'); | |
const copyPlugin = require('copy-webpack-plugin'); | |
/* creates static resource xml file in ./force-app/main/default/staticresources directory */ | |
const staticResourceCreate = require('static-resource-webpack-plugin'); | |
const staticResourcePath = path.resolve('./claritiGIS/main/default/staticresources'); | |
const ignoreTemplate = path.resolve('./arcGISApp/git-ignore-template.txt'); | |
module.exports = (_, args) => { | |
const mode = args.mode; | |
const config = { | |
mode, | |
entry: { | |
index: ['./arcGISApp/index.js', './arcGISApp/index.css'] | |
}, | |
node: false, | |
output: { | |
chunkFilename: 'chunks/bundle_[name].js', | |
path: staticResourcePath + '/ArcGISSDK', | |
assetModuleFilename: 'assets/[hash][ext][query]' | |
}, | |
optimization: { | |
mergeDuplicateChunks: true | |
}, | |
module: { | |
rules: [ | |
{ | |
test: /\.(js|jsx)$/, | |
exclude: /nodeModules/, | |
use: { | |
loader: 'babel-loader' | |
} | |
}, | |
{ | |
test: /\.css$/, | |
use: [miniCssExtractPlugin.loader, 'css-loader'] | |
} | |
] | |
}, | |
plugins: [ | |
new staticResourceCreate({ | |
staticResPath: staticResourcePath | |
}), | |
new copyPlugin({ | |
patterns: [ | |
{ | |
from: '**', | |
context: 'node_modules/@esri/calcite-components/dist/calcite/assets/', | |
to: staticResourcePath + '/CalciteAssets/assets/' | |
}, | |
{ | |
from: ignoreTemplate, | |
to: `${staticResourcePath}/ArcGISSDK/.gitignore`, | |
toType: 'template' | |
}, | |
{ | |
from: ignoreTemplate, | |
to: `${staticResourcePath}/CalciteAssets/.gitignore`, | |
toType: 'template' | |
} | |
] | |
}), | |
new arcGISPlugin({ | |
// do not copy assets | |
copyAssets: false, | |
// exclude 3D modules from build | |
features: { | |
'3d': false | |
}, | |
userDefinedExcludes: [] | |
}), | |
new miniCssExtractPlugin({ | |
filename: '[name].css', | |
chunkFilename: 'arcgis_[name].css' | |
}) | |
] | |
}; | |
return config; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment