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.

Build errors with intl-messageformat

See original GitHub issue

When building my Svelte app, I’m getting these errors from svelte-i8n (and it’s dependencies.) One thing I noticed is that the intel-messageformat project is archived. Perhaps, it’s obsolete and needs to be replaced?

yarn run v1.21.1
warning package.json: No license field
$ rollup -c

src/main.js → public/bundle.js...
(!) `this` has been rewritten to `undefined`
https://rollupjs.org/guide/en/#error-this-is-undefined
node_modules/intl-messageformat/lib/core.js
4: See the accompanying LICENSE file for terms.
5: */
6: var __assign = (this && this.__assign) || function () {
                   ^
7:     __assign = Object.assign || function(t) {
8:         for (var s, i = 1, n = arguments.length; i < n; i++) {
...and 1 other occurrence
node_modules/intl-messageformat/lib/formatters.js
1: var __extends = (this && this.__extends) || (function () {
                    ^
2:     var extendStatics = function (d, b) {
3:         extendStatics = Object.setPrototypeOf ||
...and 3 other occurrences
node_modules/intl-format-cache/lib/index.js
4: See the accompanying LICENSE file for terms.
5: */
6: var __spreadArrays = (this && this.__spreadArrays) || function () {
                         ^
7:     for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
8:     for (var r = Array(s), k = 0, i = 0; i < il; i++)
...and 1 other occurrence

...and 3 other files

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
attilamcommented, Oct 20, 2020

@attilam where do you add this code?

This was a while ago, but the code goes into rollup.config.js. So declare the onwarn function, and use it in export default as needed.

In my case it looked something like this:

// imports blah...

const onwarn = (warning, onwarn) => {
	// ignores the annoying this is undefined warning
	if (warning.code === 'THIS_IS_UNDEFINED') {
		return
	}

	onwarn(warning)
}

export default {
  input: ...,
  output: ...,
  onwarn, // <- added here
  plugins: ...
}

function serve() {
  ...
}
1reaction
kaisermanncommented, Jan 14, 2020
Read more comments on GitHub >

github_iconTop Results From Across the Web

Intl MessageFormat | Format.JS
To create a message to format, use the IntlMessageFormat constructor. The constructor takes three parameters: message - {String | AST} - String message...
Read more >
Top 5 intl-messageformat Code Examples - Snyk
To help you get started, we've selected a few intl-messageformat examples, based on popular ways it is used in public projects.
Read more >
intl-messageformat - npm
Start using intl-messageformat in your project by running `npm i ... TypeScript icon, indicating that this package has built-in type ...
Read more >
intl-messageformat-parser examples - CodeSandbox
Learn how to use intl-messageformat-parser by viewing and forking example apps that make use of intl-messageformat-parser on CodeSandbox.
Read more >
message-format | Yarn - Package Manager
A poorly formatted pattern will cause an Error to be thrown. MessageFormat instances ... args is an object containing the values to replace...
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