preprocessor.js 677 B

1234567891011121314151617181920212223242526
  1. /**
  2. * React Starter Kit (https://www.reactstarterkit.com/)
  3. *
  4. * Copyright © 2014-2016 Kriasoft, LLC. All rights reserved.
  5. *
  6. * This source code is licensed under the MIT license found in the
  7. * LICENSE.txt file in the root directory of this source tree.
  8. */
  9. 'use strict';
  10. var babel = require('babel-core');
  11. module.exports = {
  12. process: function(src, filename) {
  13. // Ignore files other than .js, .es, .jsx or .es6
  14. if (!babel.util.canCompile(filename)) {
  15. return '';
  16. }
  17. // Ignore all files within node_modules
  18. if (filename.indexOf('node_modules') === -1) {
  19. return babel.transform(src, {filename: filename}).code;
  20. }
  21. return src;
  22. }
  23. };