custom system.js loader

- disables ‘moduleId’ usage when building with webpack
This commit is contained in:
Denys Vuika 2016-12-08 15:49:19 +00:00
parent 067def255e
commit dd20f6fc78
3 changed files with 26 additions and 1 deletions

View File

@ -0,0 +1,15 @@
const moduleIdRegex = /moduleId: module.id,/g;
module.exports = function(source) {
this.cacheable();
let result = source;
let modified = false;
if (moduleIdRegex.test(source)) {
result = source.replace(moduleIdRegex, (match) => {
return `// ${match}`;
});
// console.log(result);
}
return result;
}

View File

@ -2,6 +2,7 @@ var webpack = require('webpack');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var helpers = require('./helpers');
var path = require('path');
var alfrescoLibs = [
helpers.root('node_modules', 'alfresco-js-api'),
@ -40,6 +41,12 @@ module.exports = {
}
},
resolveLoader: {
alias: {
'systemjs-loader': helpers.root('config', 'loaders', 'system.js')
}
},
module: {
loaders: [
{
@ -52,7 +59,7 @@ module.exports = {
include: [
...alfrescoLibs
],
loader: 'angular2-template-loader',
loaders: ['angular2-template-loader', 'systemjs-loader']
},
{
test: /\.html$/,

View File

@ -40,7 +40,10 @@ import {
ImageResolver
} from './../data/share-datatable-adapter';
declare var module: any;
@Component({
moduleId: module.id,
selector: 'alfresco-document-list',
styleUrls: ['./document-list.css'],
templateUrl: './document-list.html'