Skip to content

Commit 8d40d11

Browse files
authored
Merge pull request #1241 from btecu/typescript
Export version without jQuery
2 parents cb2856f + 21be39f commit 8d40d11

File tree

3 files changed

+22
-4
lines changed

3 files changed

+22
-4
lines changed

src/gridstack-only.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// index.ts 2.0.0-rc @preserve
2+
3+
/**
4+
* A package's root file. Exports all non jQuery exported classes.
5+
*/
6+
import './gridstack-poly.js';
7+
8+
export * from './types';
9+
export * from './utils';
10+
export * from './gridstack-engine';
11+
export * from './gridstack-dragdrop-plugin';
12+
export * from './gridstack';

src/jqueryui-gridstack-dragdrop-plugin.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { GridItemHTMLElement } from './types';
1212

1313
// TODO: TEMPORARY until can remove jquery-ui drag&drop and this class and use HTML5 instead !
1414
// see https://stackoverflow.com/questions/35345760/importing-jqueryui-with-typescript-and-requirejs
15-
import * as $ from './jquery.js';
15+
import * as $ from 'jquery';
1616
import './jquery-ui.js';
1717

1818
/**
@@ -110,4 +110,4 @@ JQueryUIGridStackDragDropPlugin.prototype.constructor = JQueryUIGridStackDragDro
110110
....
111111
scope.JQueryUIGridStackDragDropPlugin = JQueryUIGridStackDragDropPlugin;
112112
return JQueryUIGridStackDragDropPlugin;
113-
*/
113+
*/

webpack.config.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
const path = require('path');
22

33
module.exports = {
4-
entry: './src/index.ts',
4+
entry: {
5+
'gridstack-all': './src/index.ts',
6+
'gridstack-no-jquery': './src/gridstack-only.ts'
7+
},
8+
externals: {
9+
jquery: 'jQuery'
10+
},
511
mode: 'development',
612
module: {
713
rules: [
@@ -16,7 +22,7 @@ module.exports = {
1622
extensions: [ '.ts', '.js' ],
1723
},
1824
output: {
19-
filename: 'gridstack.all.js',
25+
filename: '[name].js',
2026
path: path.resolve(__dirname, 'dist'),
2127
library: 'GridStack',
2228
libraryExport: 'GridStack',

0 commit comments

Comments
 (0)