Error parsing triggers: Cannot find module '#custom-path' - firebase

I'm trying to use Path Mapping for Cloud Functions but when I use a custom path like import * as b from '#custom-path/barrel' I get an error on tslint for implicit imports. If I disable this rule and try to deploy, I get the following error:
Error parsing triggers: Cannot find module '#custom-path'
"baseUrl": "../",
"paths": {
"#be-utils/*": ["functions/src/utils/*"],
}
Am I doing something wrong?
If not, how can I use path mapping with Cloud Functions?
Thanks.

Related

Local image import in nextjs with jest (react-testing-library) failed

I'm getting the below error while writing the test case against my home page, which contains the landing image.
FAIL src/test/unit/pages/home.test.tsx
● Test suite failed to run
Jest encountered an unexpected token
Jest failed to parse a file. This happens e.g. when your code or its dependencies use non-standard JavaScript syntax, or when Jest is not configured to support such syntax.
Out of the box Jest supports Babel, which will be used to transform your files into valid JS based on your Babel configuration.
By default "node_modules" folder is ignored by transformers.
Here's what you can do:
• If you are trying to use ECMAScript Modules, see https://jestjs.io/docs/ecmascript-modules for how to enable it.
• If you are trying to use TypeScript, see https://jestjs.io/docs/getting-started#using-typescript
• To have some of your "node_modules" files transformed, you can specify a custom "transformIgnorePatterns" in your config.
• If you need a custom transformation specify a "transform" option in your config.
• If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the "moduleNameMapper" config option.
You'll find more details and examples of these config options in the docs:
https://jestjs.io/docs/configuration
For information about custom transformations, see:
https://jestjs.io/docs/code-transformation
Details:
/Users/xys/Documents/work/working/project-code/client/src/asset/images/landing/landing.png:1
({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,jest){�PNG
SyntaxError: Invalid or unexpected token
> 1 | import LandingImage from '~/asset/images/landing/landing.png';
| ^
2 |
3 | const Images = {
4 | LandingImage
at Runtime.createScriptFromCode (node_modules/jest-runtime/build/index.js:1796:14)
at Object.<anonymous> (src/asset/index.tsx:1:1)
Test Suites: 1 failed, 1 total
Tests: 0 total
Snapshots: 0 total
Time: 1.012 s
Ran all test suites related to changed files.
I have tried the below-suggested solution in jest.config.js file but unable to resolve this.
"\\.(jpg|ico|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/client/src/tests/unit/fileMock.js",
Also, I tried all the solutions suggested in the below site.
Importing images breaks jest test
If you try to import an image (binary file), please try this within your package.json file:
"jest": {
"moduleNameMapper": {
"\\.(jpg|ico|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/client/src/tests/unit/fileMock.js",
}
}
get more information in jest docs here: https://jestjs.io/docs/code-transformation

How to fix: "deno error: Cannot resolve module 'x'"

I've got an error like so:
error: Cannot resolve module "<path>/src/routes" from "<path>/src/index.ts"
Imported from "file:///F:/Development/k8demo/api-deno/src/index.ts:2"
My problem was that Deno requires a .ts extension for imports unlike node.
Fix by adding .ts to the import.

Atom Quokka plugin error: Unexpected token import when importing a module written with ES6 -

I am trying to use the wonderful Quokka package by WallabyJS https://github.com/wallabyjs/atom-quokka.
I am trying to import an ES6 module but keep getting an error in the Quokka console:
Unexpected token import at createScript vm.js:56
I have tried updating my package.json file and set babel: true as advised in the configuration page here but i still get the error.
Link to my package.json file here
You need to specify react-app preset in your Quokka config, so instead of "babel: true", you need:
babel: {
presets: ['react-app']
}

Webpack-Dev-Server giving error 'You may need an appropriate loader to handle this file type' for .jsx file

I am using the grunt-webpack. Trying to start the webpack-dev-server gives this error
Module parse failed: /u/saxenat/react-blueprint/src/js/app.jsx Unexpected token (5:16)
You may need an appropriate loader to handle this file type.
Before you close this question, let me just say: webpack is bundling the files properly. The grunt-webpack plugin provides 2 tasks: grunt-webpack and grunt-webpack-dev-server. When I try HMR with the server, it is failing. Otherwise it works fine.
I have included babel-loader with presets es-2015 and react.
Any ideas?

How to set up decorators in Babel 5?

Decorators in my project do not work. I include this as first line import 'babel-core/polyfill' but still have an error
Module build failed: SyntaxError: .../index.js: Unexpected token
If you really need babel5 instead of babel6 here is documentation for the former
https://github.com/babel/babel.github.io/blob/5.0.0/docs/usage/experimental.md
you can have .babelrc in your project root with content:
{
"optional": ["es7.decorators"],
}

Resources