You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am attempting to use typescript with nwb. When running "nwb build-react-component", webpack is invoked to build the demo which works fine, but when it comes to producing the cjs/es, I looked around in the code and it appears to bypass webpack entirely, and hence the necessary config for typescript. When I use the --no-demo param it tells me "Creating ES5 build" but nothing ever gets output. I need to use webpack to for its other bundling features including handling scss files.
Why does it bypass webpack when building modules? And is there something else I should be doing to get typescript working in this scenario and also getting sass to bundle properly at the same time?
Here is the nwb code that produces the ES5 module and the demo, notice "runBabel" vs "webpackBuild":
moduleBuild.js, line 166 --
if(userConfig.npm.cjs!==false){tasks.push((cb)=>runBabel('ES5',{copyFiles,outDir: path.resolve('lib'), src},merge(buildConfig.babel,buildConfig.babelDev||{},{// Don't force CommonJS users of the CommonJS build to eat a .requirecommonJSInterop: true,// Transpile modules to CommonJSmodules: 'commonjs',// Don't set the path to nwb's babel-runtime, as it will need to be a// peerDependency of your module if you use transform-runtime's helpers// option.setRuntimePath: false,// Don't enable webpack-specific pluginswebpack: false,}),userConfig,cb))}
And the snippet that creates the demo build:
build-demo.js, line 50 --
According to https://iamturns.com/typescript-babel/, babel will transpile .ts files if --extensions '.ts' is passed to the babel-cli, but unfortunately not settable in .babelrc. So webpack really needs to be in the mix to make this work.
I am attempting to use typescript with nwb. When running "nwb build-react-component", webpack is invoked to build the demo which works fine, but when it comes to producing the cjs/es, I looked around in the code and it appears to bypass webpack entirely, and hence the necessary config for typescript. When I use the --no-demo param it tells me "Creating ES5 build" but nothing ever gets output. I need to use webpack to for its other bundling features including handling scss files.
Why does it bypass webpack when building modules? And is there something else I should be doing to get typescript working in this scenario and also getting sass to bundle properly at the same time?
Here is the nwb code that produces the ES5 module and the demo, notice "runBabel" vs "webpackBuild":
moduleBuild.js, line 166 --
And the snippet that creates the demo build:
build-demo.js, line 50 --
My nwb.config.js looks like ..
The text was updated successfully, but these errors were encountered: