Giter VIP home page Giter VIP logo

Comments (3)

lukeed avatar lukeed commented on August 17, 2024 2

Slightly unrelated, but you're being a little too haphazard with the mutable config 😬The one "gotcha" of exposing the entire object.

You're removing all of the aliases, many of which PWA needs to remain intact. For reference, here are all of PWA's aliases.

The @ alias points to your /src directory out of the box. If I were you, I'd use that (or at least add new aliases with the @ prefix) as to 100% avoid/bypass trying to resolve a npm dependency instead of your alias.

import myStyle from '@/styles/foobar.css'
import Hello from '@/js/hello';

// note that "@assets" is already setup for you
import Video from '@assets/video.mp4';

If you're dead-set on adding new aliases, I'd do it like this:

const { join } = require('path');

module.exports = function (config, env) {
  // PUSH into extensions, not overwrite
  config.resolve.extensions.push('.scss', '.css', '.pdf', '.zip', '.mp4', '.jpg', '.png');

  // add individual aliases
  //~> PS: still highly recommend you use "@___" aliases instead
  // Note: `env.src` === "/src" directory
  config.resolve.alias['styles'] = join(env.src, 'styles');
  config.resolve.alias['js'] = join(env.src, 'js');
}

Lemme know how that goes 👍

from pwa.

lukeed avatar lukeed commented on August 17, 2024 1

Awesome! 🎉 You're welcome

from pwa.

guilhermeutzig avatar guilhermeutzig commented on August 17, 2024

Ohhh I got it, tested both ways and both worked!!

I will use @ prefix as you said, I was struggling a little bit to make it work, didn't quite get the concept of the thing.

Thank you very much for your help!

from pwa.

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.