Giter VIP home page Giter VIP logo

webpack-template's Issues

Ошибка unable to locate

Привет! Я решила заюзать твой темплейт для реакта и столкнулась со следующей ошибкой:

Failed to compile.
unable to locate 'C:\Users\username\Desktop\webpack-react-template\src\assets\img' at 'C:\Users\username\Desktop\webpack-react-template\src\assets\img***'

Ошибка проявляется только в тех случаях, когда в папке img пусто.

Папка dist при dev сборке

Привет!
Подскажи, а как сделать чтоб папка dist собиралась при dev сборке?
Это надо чтоб бекендеры тоже могли отслеживать изменения в стилях и скриптах. Когда он себе подключает app.css и app.js и правит в файлах фронта.
Спасибо!

Module parse failed

После разделения конфигов вебпака в 3 видео появилась такая ошибка:
ERROR in ./src/index.js
Module not found: Error: Can't resolve '/css/main.css' in 'D:\Development\Presentation\src'
@ ./src/index.js 2:0-22

ERROR in ./src/index.js
Module not found: Error: Can't resolve '/scss/main.scss' in 'D:\Development\Presentation\src'
@ ./src/index.js 3:0-24

очевидно тут про недоступность файлов, поменял содержимое index.js таким образом
import './css/main.css' import './scss/main.scss' window.Vue = require('vue')

после этого ошибка поменялась на:

ERROR in ./src/scss/main.scss 1:0
Module parse failed: Unexpected character '@' (1:0)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders

@import "utils/libs";
| @import "utils/vars";
| @import "utils/mixins";
@ ./src/index.js 3:0-25

ERROR in ./src/css/main.css 1:0
Module parse failed: Unexpected token (1:0)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders

.wrapper {
| display: flex;
| }
@ ./src/index.js 2:0-23

проблема с лодером, но что именно не так не понятно

publicPath

Заметил, что при билде получаются относительные пути и файлы не находятся.
Заменил без точки
publicPath: "/"
на с точкой
publicPath: "./"

Все заработало как надо.

Local fonts doesn't loading

I'm going onto your guide for local fonts but I can't see my font on dev and prod UI.

Fonts are copying by config:

new CopyWebpackPlugin({
      patterns: [
        // `shared/img` to `dist/static/img`
        {
          from: `${defines.src}/shared/img`,
          to: `${defines.dist}/${defines.static}/img`
        },

        // others:
        // `shared/fonts` to `dist/static/fonts`
        {
          from: `${defines.src}/shared/fonts`,
          to: `${defines.dist}/${defines.static}/fonts`
        },
      ]
    }),

I've copied fonts into src/shared/fonts/ and added file src/app/styles/fonts.scss:

@font-face {
  font-family: "PTRootUI";
  font-style: normal;
  font-weight: 500;
  font-stretch: 100%;
  font-display: swap;
  src: url("/static/fonts/PTRootUIMedium.woff2") format("woff2");
  unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}

@font-face {
  font-family: "PTRootUI";
  font-style: normal;
  font-weight: 700;
  font-stretch: 100%;
  font-display: swap;
  src: url("/static/fonts/PTRootUIBold.woff2") format("woff2");
  unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}

And finally I've added it in globals.scss just like in your guide:

font-family: "PTRootUI", sans-serif !important;

On web page devtools I see the name of font "PTRootUI", but it's not my font, it's just a system sans-serif font. What am I doing wrong?

All another stuff working great (styles, images, include import images in scss files etc.). Fonts are copying into build (dist folder) but I can not see it on page.

Ошибка PATHS

Вместо
const PATHS = {
src: path.join(__dirname, '../src'),
dist: path.join(__dirname, '../dist'),
assets: 'assets/'
}
должно быть
const PATHS = {
src: path.join(__dirname, './src'),
dist: path.join(__dirname, './dist'),
assets: 'assets/'
}

лишняя точка и появляется ошибка

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.