Skip to content

Conversation

@claudiordgz
Copy link

@claudiordgz claudiordgz commented Jul 1, 2018

Hi all,

I'm compiling a TypeScript library to be used on Node Applications (Lambdas). I tried using this plugin but couldn't get past the cannot read property of _value of undefined problem.

Turns out _source comes null for more than MultiModule. The first one I found was ConcatenatedModule.

index_js_ _horseshoe

I kept digging and found that _source also comes null for everyone on this list (but not limited to tho):

  • MultiModule
  • ConcatenatedModule
  • ExternalModule
  • ContextModule

I tried just doing if (mod._source === null) return; with great success, all my TS code appeared in a single folder as javascript, but with the .ts file extension.

So I added the following to handle this:

const path = require('path');
const EmitAllPlugin = require('webpack-emit-all-plugin');
{
    plugins: [
        new EmitAllPlugin({
            ignorePattern: /node_modules/ // default,
            path: path.join(__dirname, 'unbundled-out') // defaults to `output.path`
            fileExtension: 'js', // replaces any .ext with this one
            replacePath: { 
                path: 'src',  // if the output file has /src/ on it 
                replacement: '' // replace it with this
            }
        })
    ]
}

This might not be desired/wanted I just did it because it was pretty simple, so no hard feelings if it's a non-issue and you close it.

@claudiordgz
Copy link
Author

just saw that #5 is doing some form of file renaming manipulation, looks like a better approach than this one

// ConcatenatedModule
// ExternalModule
// ContextModule
if (mod._source === null) return;
Copy link
Owner

@DrewML DrewML Jul 2, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we just keep this fix in this PR, and then I'll merge #5 (want to make sure @bv-loveholidays gets credit for doing that part)? Then I can merge + release both

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done! 💃

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh oops, I don't know how I missed this.

@DrewML
Copy link
Owner

DrewML commented Jul 2, 2018

Thanks @claudiordgz! Appreciate the PR. Just that one comment 😃

@DrewML DrewML mentioned this pull request Jul 2, 2018
@JordanShurmer
Copy link

so, is this ready to mrege?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants