question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Issues using Typescript and Webpack

See original GitHub issue

Hi,

I’m trying to use this lib in a typescript + webpack project. I’ve installed the module: npm install azure-storage --save

When running webpack build I get errors in a lot of files from the library, there are two types of errors: For .json files:

ERROR in ./~/azure-storage/~/har-validator/lib/schemas/pageTimings.json
Module parse failed: C:\projects\foo\node_modules\azure-storage\node_modules\har-validator\lib\schemas\pageTimings.json Unexpected token
You may need an appropriate loader to handle this file type.
| {
|   "type": "object",
|   "properties": {
|     "onContentLoad": {
 @ ./~/azure-storage/~/har-validator/lib/schemas/index.js 13:15-44
 @ ./~/azure-storage/~/har-validator/lib/index.js
 @ ./~/azure-storage/~/request/lib/har.js
 @ ./~/azure-storage/~/request/request.js
 @ ./~/azure-storage/~/request/index.js
 @ ./~/azure-storage/lib/common/services/storageserviceclient.js
 @ ./~/azure-storage/lib/common/common.js
 @ ./~/azure-storage/lib/azure-storage.js
 @ ./~/azure-storage-simple/dist/index.js
 @ ./src ^\.\/.*$
 @ ./~/aurelia-loader-webpack/dist/commonjs/aurelia-loader-webpack.js
 @ multi aurelia

For .js files:

ERROR in ./~/azure-storage/~/form-data/lib/form_data.js
Module not found: Error: Can't resolve 'fs' in 'C:\projects\foo\node_modules\azure-storage\node_modules\form-data\lib'
 @ ./~/azure-storage/~/form-data/lib/form_data.js 7:9-22
 @ ./~/azure-storage/~/request/request.js
 @ ./~/azure-storage/~/request/index.js
 @ ./~/azure-storage/lib/common/services/storageserviceclient.js
 @ ./~/azure-storage/lib/common/common.js
 @ ./~/azure-storage/lib/azure-storage.js
 @ ./~/azure-storage-simple/dist/index.js
 @ ./src ^\.\/.*$
 @ ./~/aurelia-loader-webpack/dist/commonjs/aurelia-loader-webpack.js
 @ multi aurelia

A third error for .js files is like this:

ERROR in ./~/forever-agent/index.js
Module not found: Error: Can't resolve 'tls' in 'C:\projects\foo\node_modules\forever-agent'
 @ ./~/forever-agent/index.js 7:10-24
 @ ./~/azure-storage/~/request/request.js
 @ ./~/azure-storage/~/request/index.js
 @ ./~/azure-storage/lib/common/services/storageserviceclient.js
 @ ./~/azure-storage/lib/common/common.js
 @ ./~/azure-storage/lib/azure-storage.js
 @ ./~/azure-storage-simple/dist/index.js
 @ ./src ^\.\/.*$
 @ ./~/aurelia-loader-webpack/dist/commonjs/aurelia-loader-webpack.js
 @ multi aurelia

I’m using aurelia but I don’t think it is related to the aurelia loader. Any help is appreciated.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
hasonmsftcommented, Jul 29, 2016

@mikeesouth , the webpack works fine from my side. If you meet the error - module not found: Error: Cannot resolve module 'browserify-fs', run npm install browserify-fs.

Here is my result and configuration for your reference: Result:

E:\tmp\webpacktest>webpack
Hash: 9057c910d20f69785140
Version: webpack 1.13.1
Time: 2710ms
    Asset     Size  Chunks             Chunk Names
bundle.js  3.65 MB       0  [emitted]  main
   [0] ./index.js 62 bytes {0} [built]
    + 404 hidden modules
  • package.json:
{
  "name": "webpacktest",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "azure-storage": "^1.1.0"
  },
  "devDependencies": {
    "json-loader": "^0.5.4",
    "webpack": "^1.13.1"
  }
}
  • webpack.config.js:
module.exports = {
     entry: './index.js',
     output: {
         path: '.',
         filename: 'bundle.js'
     },
     module: {
          loaders: [
              { test: /\.json$/, loader: 'json-loader' }
          ]
      },
     resolve: {
         extensions: ['', '.webpack.js', '.web.js', '.js']
     },
     node:{
        console: 'empty',
        fs: 'empty',
        net: 'empty',
        tls: 'empty'
    }
 };
  • index.js
var storage = require('azure-storage');
console.log(storage);
0reactions
vinjiangcommented, Mar 9, 2018

Feel free to let us know if further assistance required.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using webpack with TypeScript - LogRocket Blog
Learn how to use webpack to compile TypeScript to JavaScript and bundle source code into a single JavaScript file.
Read more >
TypeScript - webpack
TypeScript is a typed superset of JavaScript that compiles to plain JavaScript. In this guide we will learn how to integrate TypeScript with...
Read more >
Integrating TypeScript with Webpack - Medium
In this lesson, we are going to learn how to compile a TypeScript project using Webpack. This setup becomes necessary if you want...
Read more >
Inconsistency with TypeScript in Module Resolution with Fully ...
Bug report What is the current behavior? When using extention .js as part of an import (fully-specified ESM import), webpack fails to create ......
Read more >
Using Webpack with TypeScript
Webpack is a popular tool that we can use to bundle all our JavaScript code into a single minified file. It is capable...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found