Updated plugin code to work with newer webpack

pull/516/head
Piero Toffanin 2018-09-06 09:33:44 -04:00
rodzic df1696f61e
commit e5604aa3c0
5 zmienionych plików z 11 dodań i 4 usunięć

Wyświetl plik

@ -39,6 +39,13 @@ export default class ApiFactory{
this.events.addListener(`${api.namespace}::${eventName}`, args => { this.events.addListener(`${api.namespace}::${eventName}`, args => {
Promise.all(callbackOrDeps.map(dep => SystemJS.import(dep))) Promise.all(callbackOrDeps.map(dep => SystemJS.import(dep)))
.then((...deps) => { .then((...deps) => {
// For each dependency, see if it exports a default module (ES6 style)
// if it does, export just the default module, otherwise export all modules
deps = deps.map(dep => {
return dep.map(exp => exp.default ? exp.default : exp);
});
const response = { const response = {
result: callbackOrUndef(...(Array.from([args]).concat(...deps))), result: callbackOrUndef(...(Array.from([args]).concat(...deps))),
placeholder: args._placeholder placeholder: args._placeholder

Wyświetl plik

@ -4,7 +4,7 @@ import './MeasurePopup.scss';
import $ from 'jquery'; import $ from 'jquery';
import L from 'leaflet'; import L from 'leaflet';
module.exports = class MeasurePopup extends React.Component { export default class MeasurePopup extends React.Component {
static defaultProps = { static defaultProps = {
map: {}, map: {},
model: {}, model: {},

Wyświetl plik

@ -7,7 +7,7 @@ import ReactDOM from 'ReactDOM';
import React from 'react'; import React from 'react';
import $ from 'jquery'; import $ from 'jquery';
module.exports = class App{ export default class App{
constructor(map){ constructor(map){
this.map = map; this.map = map;

Wyświetl plik

@ -5,7 +5,7 @@ import Storage from 'webodm/classes/Storage';
import ErrorMessage from 'webodm/components/ErrorMessage'; import ErrorMessage from 'webodm/components/ErrorMessage';
import $ from 'jquery'; import $ from 'jquery';
module.exports = class ShareButton extends React.Component{ export default class ShareButton extends React.Component{
static defaultProps = { static defaultProps = {
task: null, task: null,
token: "" token: ""

Wyświetl plik

@ -1,5 +1,5 @@
import React from 'react'; // can import React import React from 'react'; // can import React
module.exports = { export default {
es6func: () => {} // ES6 transpiler works es6func: () => {} // ES6 transpiler works
}; };