Git Product home page Git Product logo

Comments (8)

Rich-Harris avatar Rich-Harris commented on August 19, 2024 1

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.

Rich-Harris avatar Rich-Harris commented on August 19, 2024

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.

arxpoetica avatar arxpoetica commented on August 19, 2024

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.

Rich-Harris avatar Rich-Harris commented on August 19, 2024

I don't think I understand, can you ELI5?

from sapper-template.

arxpoetica avatar arxpoetica commented on August 19, 2024

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.

arxpoetica avatar arxpoetica commented on August 19, 2024

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.

Rich-Harris avatar Rich-Harris commented on August 19, 2024

@arxpoetica we good to close this?

from sapper-template.

arxpoetica avatar arxpoetica commented on August 19, 2024

I never got around to testing it, but I'll reopen if I run into bumps.

from sapper-template.

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.