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.

dep.getResourceIdentifier is not a function (bundle android release)

See original GitHub issue

Current Behavior

The following command is being executed during :app:bundleReleaseJsAndAssets and fails with cryptic error dep.getResourceIdentifier is not a function. No stacktrace whatsoever. I’ve stripped long paths for brevity.

node node_modules/haul/bin/cli.js bundle \
--platform android --dev false --reset-cache \
--entry-file index.android.js \
--bundle-output android\app\build\intermediates\assets\release\index.android.bundle \
--assets-dest android\app\build\intermediates\res\merged\release

Expected Behavior

Would be lovely to get the bundle 😃 I do suspect something wrong with entry file seeing command above that there is index.android.js instead of index.ts I have in my webpack.config.js. This part is somewhat confusing. I even tried changing it to index.ts, but no change of the result.

It’s also strange why I am getting warning about deprecated configuration style.

Haul Configuration (webpack.haul.js)

const Dotenv = require('dotenv-webpack')
const path = require('path')
const tsconfig = require('./tsconfig.json')

const { baseUrl, paths } = tsconfig.compilerOptions
const baseDir = path.resolve(__dirname, baseUrl)

module.exports = ({ platform, dev }, { module, resolve, plugins }) => ({
  entry: `./src/index.ts`,
  module: {
    ...module,
    rules: [
      {
        test: /\.tsx?$/,
        loader: 'ts-loader',
      },
      ...module.rules,
    ],
  },
  resolve: {
    ...resolve,
    extensions: [
      '.ts',
      '.tsx',
      `.${platform}.ts`,
      '.native.ts',
      `.${platform}.tsx`,
      '.native.tsx',
      ...resolve.extensions,
    ],
    alias: {
      assets: path.resolve(__dirname, 'assets'),
    },
    modules: [path.resolve(__dirname, 'src'), 'node_modules'],
  },
  plugins: [...plugins, new Dotenv({ path: dev ? '.env.local' : '.env.prod' })],
})

Typescript configuration (tsconfig.json)

{
  "compilerOptions": {
    "baseUrl": "src",
    "paths": {
      "src/*": ["src/*"],
      "assets/*": ["../assets/*"]
    },
    "target": "es5",
    "module": "esnext",
    "lib": ["es2017", "dom", "esnext.asynciterable"],
    "moduleResolution": "node",
    "jsx": "react",
    "outDir": "artifacts",
    "rootDirs": ["src", "assets"],
    "sourceMap": true,
    "allowJs": false,
    "allowSyntheticDefaultImports": true,
    "forceConsistentCasingInFileNames": true,
    "preserveConstEnums": true,
    "noImplicitAny": false,
    "noImplicitReturns": true,
    "noImplicitThis": true,
    "noUnusedParameters": true,
    "noUnusedLocals": true,
    "strictNullChecks": true,
    "plugins": [
      {
        "name": "typescript-styled-plugin"
      },
      {
        "name": "typescript-snapshots-plugin",
        "testBlockIdentifiers": ["test"]
      }
    ]
  },
  "filesGlob": ["typings/index.d.ts", "src/**/*.ts", "src/**/*.tsx"],
  "types": ["react", "react-native", "jest"],
  "exclude": ["android", "ios", "build", "node_modules"],
  "compileOnSave": false
}

Your Environment

Windows 10 x64

software version
Haul 1.0.0-rc.0
react-native 0.55.3
node 9.11.1
yarn 1.5.1
ts-loader 4.2.0

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
danielkczcommented, Jul 11, 2018

Nice finding @jukben. I would just add it might be better to use Yarn resolutions instead of installing dependency you are not using directly.

0reactions
jukbencommented, Jul 11, 2018

I think I’ve found the issue!

In my case it was because the node_modules/webpack was version 3.x – required by storybook, however, Haul is using version 4. Thus once the Dotenv plugin tried to add webpack.DefinePlugin it looked up for version 3.x, not 4.x thus the issue raised.

Easiest fix is to add "webpack": "^4.12.0" into dependencies, the problem is gone.

Finally.

Closing for now, feel free to comment it if you’d like.

P.S: In my case, @storybook/core have required version 3. You can get the info which package wants version 3 in yarn.lock. That was the reason why I haven’t been able to reproduce it. I would have to install Dotenv along to storybook and I haven’t done it. Let me know what was the problematic dependency in your case.

Read more comments on GitHub >

github_iconTop Results From Across the Web

webpack - TypeError: dep.getResourceIdentifier is not a function
It seems like Laravel Mix is not yet compatible with Webpack 4. The only thing I found we can do for now is...
Read more >
Diff - platform/frameworks/base - Google Git
IndentingPrintWriter, but it's not available in all branches. - "core/java/com/android/internal/util/IndentingPrintWriter.java", ...
Read more >
Android apps build failing - Build issue - AppGyver forums
Unable to build android app ... AB version: 1.7.6 COMMAND: ... isTSSatisfiesExpression is not a function at Object.
Read more >
Untitled
Maxim's bakery cake menu, Force landscape mode android app, Convert string to datetime c# ... Ali filsoof, Top music releases 2014, Fazrulz1 example...
Read more >
Changelog - HERE Data SDK for TypeScript - HERE Developer
Tutorial notebooks and examples are now available singly via GitHub in addition to downloadable .zip bundle in Developer Guide ...
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