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

Can you expose-loader this with ts-loader? #35

Closed
hgiesel opened this issue Feb 21, 2017 · 1 comment
Closed

Can you expose-loader this with ts-loader? #35

hgiesel opened this issue Feb 21, 2017 · 1 comment

Comments

@hgiesel
Copy link

hgiesel commented Feb 21, 2017

Configuration:

  • index.ts
let foo = "Hello "
let bar = "World";
document.write(_.camelCase(foo + bar))
  • webpack.config.js
module.exports = {
  entry: "./src/index.ts",
  output: {
    filename: "bundle.js"
  },

  resolve: {
    extensions: ['.ts', '.tsx', '.js']
  },
  module: {
    loaders: [{
      test: require.resolve('lodash'),
      loader: 'expose-loader?_'
    }, {
      test: /\.ts$/,
      loader: 'ts-loader'
    }]
  }
}

Expected behavior:

  • get a compiled file called bundle.js

Actual behavior:

ERROR in ./src/index.ts
(6,16): error TS2686: '_' refers to a UMD global, but the current file is a module. Consider adding an import instead.
@michael-ciniawsky
Copy link
Member

michael-ciniawsky commented Mar 26, 2017

@hgiesel The propose of expose-loader is to add packages to window, as the Error suggests, for your usecase, use an import instead import _ from 'lodash'

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

No branches or pull requests

2 participants