Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

now js code compiled from server side ts will not contain helper functions #168

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 23 additions & 10 deletions yog2-fis3.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ var serverRoadmap = {
parser: fis.plugin('typescript', {
module: 1,
target: 2,
sourceMap: true
sourceMap: true,
importHelpers: true,
}),
rExt: 'js'
},
Expand Down Expand Up @@ -153,33 +154,38 @@ fis.media('prod').match('/client/{**.ts,**.tsx,**.jsx,**.es}', {
target: 0
}),
rExt: 'js'
}).match('/server/{**.ts,**.es}',{
}).match('/server/{**.ts,**.es}', {
parser: fis.plugin('typescript', {
module: 1,
target: 2
target: 2,
importHelpers: true,
}),
rExt: 'js'
});

fis.enableES7 = function (options) {
[fis.media('dev'), fis.media('debug'), fis.media('debug-prod')].forEach(function (media) {
fis.enableES7 = function(options) {
[fis.media('dev'), fis.media('debug'), fis.media('debug-prod')].forEach(function(media) {
media.match('/server/**.js', {
parser: fis.plugin('typescript', {
module: 1,
target: 2,
sourceMap: true
sourceMap: true,
importHelpers: true,
})
});
});
fis.match('/server/**.js', {
parser: fis.plugin('typescript', {
module: 1,
target: 2
target: 2,
importHelpers: true,
})
});
};

fis.enableNPM = function (options) {
fis.enableNPM = function(options) {
options = options || {};

fis.match('/client/node_modules/**.js', {
isMod: true
});
Expand Down Expand Up @@ -217,7 +223,14 @@ fis.enableNPM = function (options) {
]
});
fis.unhook('components');
fis.hook('node_modules');

var nodeModulesHookOptions = require('util')._extend({
shimProcess: false,
shimGlobal: false,
shimBuffer: false
}, options.node_modules || {});

fis.hook('node_modules', nodeModulesHookOptions);
};

// 模块化支持
Expand Down Expand Up @@ -260,4 +273,4 @@ fis.match('::package', {
map.setContent(JSON.stringify(ret.map, null, 4));
ret.pkg[map.subpath] = map;
}
});
});