Created
April 23, 2020 16:39
-
-
Save Tug/7dc4ce478c9d9e318ff504301cf86cf0 to your computer and use it in GitHub Desktop.
Metro debugging scss imports
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const babelConfig = _objectSpread( | |
{ | |
// ES modules require sourceType='module' but OSS may not always want that | |
sourceType: "unambiguous" | |
}, | |
buildBabelConfig(filename, options, plugins), | |
{ | |
caller: { | |
name: "metro", | |
platform: options.platform | |
}, | |
ast: true, | |
code: true | |
} | |
); | |
const sourceAst = parseSync(src, babelConfig); | |
if ( filename.includes( 'rich-text/src/component/index') ) { | |
console.log( 'babelConfig', babelConfig ); | |
const scssImportIndex = src.indexOf('.scss'); | |
console.log( 'src:', src.substring( scssImportIndex - 60, scssImportIndex + 10 )); | |
} | |
const result = transformFromAstSync(sourceAst, src, babelConfig); | |
if ( filename.includes( 'rich-text/src/component/index') ) { | |
const scssRequireIndex = result.code.indexOf('.scss'); | |
console.log( 'result', result.code.substring( scssRequireIndex - 60, scssRequireIndex + 10 )); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
transform[stdout]: babelConfig { sourceType: 'unambiguous', | |
transform[stdout]: plugins: [ [Function: ReactFreshBabelPlugin] ], | |
transform[stdout]: extends: | |
transform[stdout]: '/Users/tug/Work/gutenberg-mobile-master/gutenberg/packages/react-native-editor/babel.config.js', | |
transform[stdout]: babelrc: true, | |
transform[stdout]: code: true, | |
transform[stdout]: filename: '../rich-text/src/component/index.native.js', | |
transform[stdout]: highlightCode: true, | |
transform[stdout]: caller: { name: 'metro', platform: 'android' }, | |
transform[stdout]: ast: true } | |
transform[stdout]: src: import styles from './style.scss'; | |
transform[stdout]: result: var _styleNative=_interopRequireDefault(require("./style.native.scss")); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
transform[stdout]: babelConfig { sourceType: 'unambiguous', | |
transform[stdout]: plugins: [ [Function: ReactFreshBabelPlugin] ], | |
transform[stdout]: extends: | |
transform[stdout]: '/Users/tug/Work/gutenberg-mobile-master/gutenberg/packages/react-native-editor/babel.config.js', | |
transform[stdout]: babelrc: true, | |
transform[stdout]: code: true, | |
transform[stdout]: filename: '../rich-text/src/component/index.native.js', | |
transform[stdout]: highlightCode: true, | |
transform[stdout]: caller: { name: 'metro', platform: 'android' }, | |
transform[stdout]: ast: true } | |
transform[stdout]: src: import styles from './style.scss'; | |
transform[stdout]: result: var _style=_interopRequireDefault(require("./style.scss")); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment