Comments (8)
In that case I'd suggest using https://github.com/standard-things/esm, and loading that file inside your webpack config with
// inside webpack config
require = require('esm')(module);
const config = require('../config.js');
from sapper-template.
Sapper would need to use https://github.com/standard-things/esm, basically. I'm not sure it's justified though — is it really a pain point?
from sapper-template.
For my specific use case, yes. I have a config file that drives dotenv with a bunch of specialized settings, but I had to duplicate it exactly w requires for webpack. So now I have two duplicate config files for es6 and older require...which I have to keep parity for.
from sapper-template.
I don't think I understand, can you ELI5?
from sapper-template.
If I have shared settings or config or other files between the main Sapper app and the webpack config files, it would be nice to use one common es6 import/export
language, and not have to duplicate files to meet two standards.
I currently have two config.js files, one for webpack with require
statements and one for the main Sapper app with import/export
statements. Those two files are in essence exactly the same. I'd like to make one file to rule them all.
from sapper-template.
Huh. Already had esm installed for another thingz, but hadn't realized I could just use it™ out of the box like that for webpack.
I'll give it a try and close this ticket.
from sapper-template.
@arxpoetica we good to close this?
from sapper-template.
I never got around to testing it, but I'll reopen if I run into bumps.
from sapper-template.
Related Issues (20)
- Set start_url in manifest.json correctly
- How to publish a production site to run in an external HTTP server like Nginx? HOT 1
- npm run export error: Cannot find module sapper HOT 1
- Cannot use import statement outside a module HOT 9
- Include setupTypeScript script only in Rollup branch
- DRY out default Webpack config
- Svelte-check returns error "Cannot find module" on image import when using TypeScript HOT 2
- "Cannot use namespace 'Preload' as a type" error when typing preload function HOT 7
- Error: Unexpected character '�' (Note that you need plugins to import files that are not JavaScript) HOT 5
- Module '"*.jpg"' can only be default-imported using the 'allowSyntheticDefaultImports' flag
- Sapper Typescipt, can't spin up dev server HOT 4
- Page doesn't load. A ServiceWorker passed a promise to FetchEvent.respondWith() that rejected with ‘TypeError: NetworkError when attempting to fetch resource
- css sourcemap broken HOT 1
- sapper export to electron, broken paths
- Service worker warns: No directory provided. Skipping CSS generation HOT 11
- Types in latest Sapper incompatible with Express HOT 1
- Bug: Rollup plugin-replace: preventAssignment set to "false" HOT 11
- Getting started tutorial: Live reload not working HOT 3
- Upgrade webpack template to use svelte-loader 3.0.0 HOT 3
- Type errors after converting to TypeScript HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sapper-template.