mirror of https://github.com/status-im/metro.git
[react-packager] Make it safe to include files without a newline at the end
Summary: @public Fixes #1431 Fixes #1005 Files with no newlines and a comment at the end of the file would've caused a syntax error in the bundle: ```js __d('module', function() { hi(); // wow }) ``` This fixes the issue by inserting a new lines before `})`. Test Plan: * ./runJestTests.sh * ./runJestTests.sh PackagerIntegration * open app to the playground app * add an error * observe that the redbox has the correct lines
This commit is contained in:
parent
24026b6c25
commit
253544cb45
|
@ -600,7 +600,8 @@ describe('HasteDependencyResolver', function() {
|
|||
'require("Y")',
|
||||
'require( \'z\' )',
|
||||
'require( "a")',
|
||||
'require("b" )});',
|
||||
'require("b" )',
|
||||
'});',
|
||||
].join('\n'));
|
||||
});
|
||||
});
|
||||
|
|
|
@ -20,8 +20,7 @@ var DEFINE_MODULE_CODE = [
|
|||
'_deps_,',
|
||||
'function(global, require, requireDynamic, requireLazy, module, exports) {',
|
||||
' _code_',
|
||||
'}',
|
||||
');',
|
||||
'\n});',
|
||||
].join('');
|
||||
|
||||
var DEFINE_MODULE_REPLACE_RE = /_moduleName_|_code_|_deps_/g;
|
||||
|
|
Loading…
Reference in New Issue