Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ESM compatibility #356

Merged
merged 6 commits into from
Feb 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/stale-plums-heal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'create-svelte': patch
'@sveltejs/kit': patch
'@sveltejs/snowpack-config': patch
---

Rename _.config.js to _.config.cjs
14 changes: 6 additions & 8 deletions examples/realworld.svelte.dev/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ npm init svelte@next my-app

> Note: the `@next` is temporary


## Developing

Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:
Expand All @@ -28,14 +27,13 @@ npm run dev
npm run dev -- --open
```


## Building

Svelte apps are built with *adapters*, which optimise your project for deployment to different environments, like [Begin](https://begin.com), [Netlify](https://www.netlify.com), [Vercel](https://vercel.com) and so on. (You can also create your own adapter — instructions TODO.)
Svelte apps are built with _adapters_, which optimise your project for deployment to different environments, like [Begin](https://begin.com), [Netlify](https://www.netlify.com), [Vercel](https://vercel.com) and so on. (You can also create your own adapter — instructions TODO.)

By default, `npm run build` will generate a Node app that you can run with `node build`. To use a different adapter, install it and update your `svelte.config.js` accordingly. The following official adapters are available:
By default, `npm run build` will generate a Node app that you can run with `node build`. To use a different adapter, install it and update your `svelte.config.cjs` accordingly. The following official adapters are available:

* [@sveltejs/adapter-node](https://github.com/sveltejs/kit/tree/master/packages/adapter-node)
* [@sveltejs/adapter-static](https://github.com/sveltejs/kit/tree/master/packages/adapter-static)
* [@sveltejs/adapter-netlify](https://github.com/sveltejs/kit/tree/master/packages/adapter-netlify)
* ...more soon
- [@sveltejs/adapter-node](https://github.com/sveltejs/kit/tree/master/packages/adapter-node)
- [@sveltejs/adapter-static](https://github.com/sveltejs/kit/tree/master/packages/adapter-static)
- [@sveltejs/adapter-netlify](https://github.com/sveltejs/kit/tree/master/packages/adapter-netlify)
- ...more soon
File renamed without changes.
2 changes: 1 addition & 1 deletion examples/svelte-kit-demo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

Place to try out [@sveltejs/app](https://github.com/sveltejs/kit). Very basic and incomplete, many things haven't yet been thought through.

To start the app in development mode do `npm run dev`. To build, use `npm run build`. This will use whichever adapter is specified in `svelte.config.js`, which will also need to be installed (or linked).
To start the app in development mode do `npm run dev`. To build, use `npm run build`. This will use whichever adapter is specified in `svelte.config.cjs`, which will also need to be installed (or linked).
6 changes: 3 additions & 3 deletions packages/create-svelte/cli/modifications/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ export function update_component(cwd, filepath, replacements) {
}

/**
* Adds `svelte-preprocess` to `svelte.config.js`, if there's no preprocessor already.
* Adds `svelte-preprocess` to `svelte.config.cjs`, if there's no preprocessor already.
*/
export function add_svelte_prepocess_to_config(cwd) {
const file = path.join(cwd, 'svelte.config.js');
const file = path.join(cwd, 'svelte.config.cjs');
let config = fs.readFileSync(file, 'utf-8');

if (config.includes('preprocess:')) {
Expand All @@ -56,7 +56,7 @@ export function add_svelte_prepocess_to_config(cwd) {
* Adds plugin to snowpack config file, if not already present.
*/
export function add_snowpack_plugin_to_config(cwd, pluginname) {
const file = path.join(cwd, 'snowpack.config.js');
const file = path.join(cwd, 'snowpack.config.cjs');
let config = fs.readFileSync(file, 'utf-8');

if (config.includes(pluginname)) {
Expand Down
2 changes: 1 addition & 1 deletion packages/create-svelte/template/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ npm run dev -- --open

Svelte apps are built with _adapters_, which optimise your project for deployment to different environments, like [Begin](https://begin.com), [Netlify](https://www.netlify.com), [Vercel](https://vercel.com) and so on. (You can also create your own adapter — instructions TODO.)

By default, `npm run build` will generate a Node app that you can run with `node build`. To use a different adapter, install it and update your `svelte.config.js` accordingly. The following official adapters are available:
By default, `npm run build` will generate a Node app that you can run with `node build`. To use a different adapter, install it and update your `svelte.config.cjs` accordingly. The following official adapters are available:

- [@sveltejs/adapter-node](https://github.com/sveltejs/kit/tree/master/packages/adapter-node)
- [@sveltejs/adapter-static](https://github.com/sveltejs/kit/tree/master/packages/adapter-static)
Expand Down
3 changes: 2 additions & 1 deletion packages/create-svelte/template/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@
"@sveltejs/kit": "workspace:*",
"@sveltejs/snowpack-config": "workspace:*",
"svelte": "^3.29.0"
}
},
"type": "module"
}
Loading