Coder Social home page Coder Social logo

Comments (7)

chrisguttandin avatar chrisguttandin commented on June 15, 2024

Hi @PlkMarudny,

are you able to share you rollup config?

I guess the error could be resolved by using @rollup/plugin-babel and by making sure that it also transpiles the files inside the node_modules folder.

from audio-context-timers.

PlkMarudny avatar PlkMarudny commented on June 15, 2024

Here it is:


import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';

import livereload from 'rollup-plugin-livereload';
import { terser } from 'rollup-plugin-terser';
import autoPreprocess from 'svelte-preprocess';
import copy from "rollup-plugin-copy-assets";

import globals from "rollup-plugin-node-globals";
import builtins from 'rollup-plugin-node-builtins';

import modify from 'rollup-plugin-modify';
import replace from '@rollup/plugin-replace';
import exec from 'child_process';

import typescript from '@rollup/plugin-typescript';
import gzipPlugin from 'rollup-plugin-gzip';

import { version } from "./package.json";

const production = !process.env.ROLLUP_WATCH;

const template = "/* Asharq Breaking News version {VERSION} */";

const banner = () => {
	return new Promise((resolve, reject) => {
		exec.exec('git rev-parse --short HEAD', (error, stdout, stderr) => {
			resolve(template.replace('{VERSION}', stdout).replace('\n', ''));
		});
	});
}

export default {
	input: 'src/main.js',
	output: {
		sourcemap: false,
		format: 'iife',
		name: 'AsharqBreakingNewsApp',
		file: 'public/build/bnapp.js',
		banner: banner,
		intro: 'var global = typeof self !== undefined ? self : this;',
	},
	external: [],
	plugins: [
		modify({
			"{{config}}": "./config.prod",
			"VERSION": `version ${version}`
		}),
		replace({
			...includeEnv(),
		}),
		// copy assets
		copy({
			assets: [
				// You can include directories
				"src/assets",
				// You can also include files
				//   "src/external/buffer.bin",
			],
		}),

		svelte({
			// enable run-time checks when not in production
			dev: true,
			// we'll extract any component CSS out into
			// a separate file - better for performance
			css: css => {
				css.write('bn.css');
			},
			preprocess: autoPreprocess(),
			legacy: false
		}),

		// If you have external dependencies installed from
		// npm, you'll most likely need these plugins. In
		// some cases you'll need additional configuration -
		// consult the documentation for details:
		// https://github.com/rollup/plugins/tree/master/packages/commonjs
		resolve({
			browser: true,
			dedupe: importee => importee === 'svelte' || importee.startsWith('svelte/'),
			preferBuiltins: true
		}),
		commonjs(),
		globals(),
		typescript({
			sourceMap: false,
			inlineSourceMap: false,
			module: "ES2015"
		}),
		builtins({ preferBuiltins: true }),


		// In dev mode, call `npm run start` once
		// the bundle has been generated
		!production && serve(),

		// Watch the `public` directory and refresh the
		// browser on changes when not in production
		!production && livereload('public'),

		// If we're building for production (npm run build
		// instead of npm run dev), minify
		terser({
			compress: {
				unused: false,
				collapse_vars: false
			},
			ecma: "2017",
			ie8: false,
			safari10: false,
		}),
		gzipPlugin()
	],
	watch: {
		clearScreen: false
	}
};

function serve() {
	let started = false;

	return {
		writeBundle() {
			if (!started) {
				started = true;

				require('child_process').spawn('npm', ['run', 'start', '--', '--dev'], {
					stdio: ['ignore', 'inherit', 'inherit'],
					shell: true
				});
			}
		}
	};
}

from audio-context-timers.

PlkMarudny avatar PlkMarudny commented on June 15, 2024

Actually, it looks like 5.0.44 causes problems, 5.0.43 seems to be fine. I observed this while using snowpack with remote imports; snowpack chokes on 5.0.44, while having no issues with 5.0.43, link here: 2653

from audio-context-timers.

chrisguttandin avatar chrisguttandin commented on June 15, 2024

Thanks for the update. Do you maybe use Node.js v15? I noticed that it introduces some breaking changes and for example throws an ERR_INVALID_ARG_TYPE error which Node.js v14 would just ignore or handle gracefully. Maybe it's worth a try to downgrade to Node.js v14?

from audio-context-timers.

PlkMarudny avatar PlkMarudny commented on June 15, 2024

I use 14.5.1 unfortunately

from audio-context-timers.

chrisguttandin avatar chrisguttandin commented on June 15, 2024

I tried to replicate the error with a simple rollup config but wasn't successful. It all worked as expected.

I looks like there was no real difference between 5.0.43 and 5.0.44. It was triggered by my automatic release tool.

https://diff.intrinsic.com/audio-context-timers/5.0.43/5.0.44

The only difference is that two dependencies got an update. Those dependencies were @babel/runtime and fast-unique-numbers. The update of fast-unique-numbers was triggered by the update of @babel/runtime as well.

https://diff.intrinsic.com/fast-unique-numbers/5.0.23/5.0.24

And as it turns out the only change that happened to @babel/runtime was the version number.

https://diff.intrinsic.com/@babel/runtime/7.12.13/7.12.18

Long story short: I have no idea what is causing the problem. 🤷‍♂️

from audio-context-timers.

PlkMarudny avatar PlkMarudny commented on June 15, 2024

from audio-context-timers.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.