Skip to content

Commit

Permalink
Merge pull request #19 from keelzebub/main
Browse files Browse the repository at this point in the history
  • Loading branch information
mhsattarian authored Dec 14, 2024
2 parents 81107af + 9134ce4 commit 5ddce62
Show file tree
Hide file tree
Showing 11 changed files with 53 additions and 10 deletions.

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/mapbox-gl-draw-snap-mode.cjs.js.map

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions dist/mapbox-gl-draw-snap-mode.esm.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/mapbox-gl-draw-snap-mode.esm.js.map

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion dist/mapbox-gl-draw-snap-mode.js.map

This file was deleted.

12 changes: 9 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
{
"name": "mapbox-gl-draw-snap-mode",
"version": "0.2.1",
"version": "0.3.0",
"description": "Snapping mode for mapbox-gl-draw",
"main": "dist/mapbox-gl-draw-snap-mode.js",
"module": "src/index.js",
"main": "dist/mapbox-gl-draw-snap-mode.cjs.js",
"module": "dist/mapbox-gl-draw-snap-mode.esm.js",
"exports": {
".": {
"import": "./dist/mapbox-gl-draw-snap-mode.esm.js",
"require": "./dist/mapbox-gl-draw-snap-mode.cjs.js"
}
},
"scripts": {
"build": "webpack",
"start": "webpack serve --config ./webpack.development.js",
Expand Down
2 changes: 1 addition & 1 deletion src/modes/snap_direct_select.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import MapboxDraw from "@mapbox/mapbox-gl-draw";
import { createSnapList, getGuideFeature, IDS, snap } from "./../utils";
import { createSnapList, getGuideFeature, IDS, snap } from "./../utils/index.js";
const { doubleClickZoom } = MapboxDraw.lib;
const DirectSelect = MapboxDraw.modes.direct_select;
const Constants = MapboxDraw.constants;
Expand Down
2 changes: 1 addition & 1 deletion src/modes/snap_line.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
IDS,
shouldHideGuide,
snap,
} from "./../utils";
} from "./../utils/index.js";

const SnapLineMode = { ...DrawLine };

Expand Down
2 changes: 1 addition & 1 deletion src/modes/snap_point.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
IDS,
shouldHideGuide,
snap,
} from "./../utils";
} from "./../utils/index.js";

const { doubleClickZoom } = MapboxDraw.lib;
const DrawPoint = MapboxDraw.modes.draw_point;
Expand Down
2 changes: 1 addition & 1 deletion src/modes/snap_polygon.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
IDS,
shouldHideGuide,
snap,
} from "./../utils";
} from "./../utils/index.js";
import booleanIntersects from "@turf/boolean-intersects";

const SnapPolygonMode = { ...DrawPolygon };
Expand Down
36 changes: 35 additions & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ const BundleAnalyzerPlugin = require("webpack-bundle-analyzer")
const path = require("path");

module.exports = [

{
mode: "production",
entry: "./src/index.js",
devtool: "source-map",
output: {
path: path.resolve(__dirname, "dist"),
filename: "mapbox-gl-draw-snap-mode.js",
filename: "mapbox-gl-draw-snap-mode.cjs.js",
library: "mapboxGlDrawSnapMode",
libraryTarget: "umd",
globalObject: "this",
Expand Down Expand Up @@ -59,4 +60,37 @@ module.exports = [
// }),
],
},
{
mode: "production",
entry: './src/index.js',
devtool: "source-map",
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'mapbox-gl-draw-snap-mode.esm.js',
library: {
type: 'module'
}
},
optimization: {
minimize: true,
minimizer: [new TerserPlugin({ parallel: true })],
},
module: {
rules: [
{
test: /\.m?js$/,
exclude: /node_modules/,
use: {
loader: "babel-loader",
options: {
presets: ["@babel/preset-env"],
},
},
},
],
},
experiments: {
outputModule: true
}
}
];

0 comments on commit 5ddce62

Please sign in to comment.