Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

Sourcemaps not being built when using default template. #816

Closed
soonkia opened this issue Jul 23, 2019 · 2 comments
Closed

Sourcemaps not being built when using default template. #816

soonkia opened this issue Jul 23, 2019 · 2 comments

Comments

@soonkia
Copy link

soonkia commented Jul 23, 2019

Describe the bug
When running "npm run dev" no js sourcemaps are being generated.

I tried to figure out what's happening in the config, but just can't figure it out. So, I just forced it in ./node_modules/sapper/rollup.js

Logs
Please include browser console and server logs around the time this bug occurred.

To Reproduce
To help us help you, if you've found a bug please consider the following:

  • If possible, we recommend creating a small repo that illustrates the problem.
  • Reproductions should be small, self-contained, correct examples – http://sscce.org.

Occasionally, this won't be possible, and that's fine – we still appreciate you raising the issue. But please understand that Svelte is run by unpaid volunteers in their free time, and issues that follow these instructions will get fixed faster.

Expected behavior
I would expect sourcemaps to be generated in dev mode.

Rollup.js
If you have a stack trace to include, we recommend putting inside a <details> block for the sake of the thread's readability:

Rollup.JS file
import resolve from 'rollup-plugin-node-resolve';
import replace from 'rollup-plugin-replace';
import commonjs from 'rollup-plugin-commonjs';
import svelte from 'rollup-plugin-svelte';
import babel from 'rollup-plugin-babel';
import { terser } from 'rollup-plugin-terser';
import config from 'sapper/config/rollup.js';
import pkg from './package.json';


const mode = process.env.NODE_ENV;
const dev = mode === 'development';
console.log('dev', dev)
console.log(config.client.output());
const legacy = !!process.env.SAPPER_LEGACY_BUILD;

const onwarn = (warning, onwarn) => (warning.code === 'CIRCULAR_DEPENDENCY' && /[/\\]@sapper[/\\]/.test(warning.message)) || onwarn(warning);
const dedupe = importee => importee === 'svelte' || importee.startsWith('svelte/');

export default {
	client: {
		input: config.client.input(),
		output: config.client.output(),
		plugins: [
			replace({
				'process.browser': true,
				'process.env.NODE_ENV': JSON.stringify(mode)
			}),
			svelte({
				dev,
				hydratable: true,
				emitCss: true
			}),
			resolve({
				browser: true,
				dedupe
			}),
			commonjs(),

			legacy && babel({
				extensions: ['.js', '.mjs', '.html', '.svelte'],
				runtimeHelpers: true,
				exclude: ['node_modules/@babel/**'],
				presets: [
					['@babel/preset-env', {
						targets: '> 0.25%, not dead'
					}]
				],
				plugins: [
					'@babel/plugin-syntax-dynamic-import',
					['@babel/plugin-transform-runtime', {
						useESModules: true
					}]
				]
			}),

			!dev && terser({
				module: true
			})
		],

		onwarn,
	},

	server: {
		input: config.server.input(),
		output: config.server.output(),
		plugins: [
			replace({
				'process.browser': false,
				'process.env.NODE_ENV': JSON.stringify(mode)
			}),
			svelte({
				generate: 'ssr',
				dev
			}),
			resolve({
				dedupe
			}),
			commonjs()
		],
		external: Object.keys(pkg.dependencies).concat(
			require('module').builtinModules || Object.keys(process.binding('natives'))
		),

		onwarn,
	},

	serviceworker: {
		input: config.serviceworker.input(),
		output: config.serviceworker.output(),
		plugins: [
			resolve(),
			replace({
				'process.browser': true,
				'process.env.NODE_ENV': JSON.stringify(mode)
			}),
			commonjs(),
			!dev && terser()
		],

		onwarn,
	}
};

Information about your Sapper Installation:
Chrome 79
Windows 10
Node 10.6
Sapper 0.27.4
Rollup

Severity
Annoying - Low level

Additional context
Add any other context about the problem here.

@Conduitry
Copy link
Member

I think this is a duplicate of #590.

@soonkia
Copy link
Author

soonkia commented Jul 23, 2019

Oh, sorry, you are right. Closing

@soonkia soonkia closed this as completed Jul 23, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants