Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Push default export to global scope for typescript files #82

Closed
1 of 3 tasks
Dsupreme opened this issue Jan 31, 2019 · 2 comments
Closed
1 of 3 tasks

Push default export to global scope for typescript files #82

Dsupreme opened this issue Jan 31, 2019 · 2 comments

Comments

@Dsupreme
Copy link

  • Operating System: OS X
  • Node Version: 10.12.0
  • NPM Version: 6.5.0
  • webpack Version: "4.28.0",
  • expose-loader Version: "0.7.5"

This issue is for a:

  • bug
  • feature request
  • modification request

Code

CLI Command
   webpack --mode=development
webpack.config.js
module: {
        rules: [{
                test: /\.ts$/,
                include: path.join(__dirname, "src"),
                loader: "ts-loader"
            },
            {
                type: "javascript/auto",
                test: /\.json$/,
                loader: 'json-loader'
            },
            {
                test: require.resolve('./src/abc/index.ts'),
                loader: 'expose-loader?FP'
            }
        ]
    },
 export default class abc {
    // do something
}

Expected Behavior

abc is added to the global scope or under window

Actual Behavior

Module parse failed: Unexpected token (11:16)
You may need an appropriate loader to handle this file type.

export default class abc {} @ ./src/abc/index.ts-exposed 1:32-55

New Feature Use Case

When trying to use a class inside webpack generated bundle inside another js file (not under the scope of webpack)

@patrick-mcdougle
Copy link

This might be fixed by #85 I think the problem is that the expose loader doesn't know how to deal with harmony (ES) modules.

@cap-Bernardito
Copy link
Member

A same problem #56. Will be fixed there.

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 a pull request may close this issue.

3 participants