Skip to content

Files contains a reference to the file? #1136

Closed
@fisherspoons

Description

@fisherspoons

Hi, I am upgrading symphony version and need to migrate to webpack-encore. But when compiling files, I get a very strange error, it happens when compiling js and css files.

package.json

  "dependencies": {
    "webpack-notifier": "^1.15.0"
  },
  "devDependencies": {
    "@symfony/stimulus-bridge": "^3.2.1",
    "@symfony/webpack-encore": "^3.0.0",
    "core-js": "^3.23.5",
    "sass": "^1.53.0",
    "sass-loader": "^13.0.2"
  },
  "scripts": {
    "dev": "encore dev",
    "watch": "encore dev --watch",
    "build": "encore production --progress"
  },

webpack-config

const Encore = require('@symfony/webpack-encore');

if (!Encore.isRuntimeEnvironmentConfigured()) {
    Encore.configureRuntimeEnvironment(process.env.NODE_ENV || 'dev');
}

Encore
    .setOutputPath('web/assetic/')
    .setPublicPath('/web/assetic/')
    .setManifestKeyPrefix('web/assetic/')

    .configureFilenames({
        js: '[name].js?v=[fullhash]',
        css: '[name].css?v=[fullhash]',
    })

    .addEntry('cookies_preferences.min', './web/js/cookies-preferences.js')
    .addEntry('skins_js.min', './web/sites/skins/js/common.js')

    .addStyleEntry('skins_css.min', [
        './web/sites/skins/libs/bootstrap/scss/bootstrap.scss',
        './web/sites/skins/scss/main.scss',
        './web/sites/skins/libs/slider/slick.css'
    ])

    .enableStimulusBridge('./assets/controllers.json')

    .enableSingleRuntimeChunk()

    .cleanupOutputBeforeBuild()
    .enableBuildNotifications()
    .enableSourceMaps(!Encore.isProduction())
    .enableVersioning(Encore.isProduction())

    .configureBabel((config) => {
        config.plugins.push('@babel/plugin-proposal-class-properties');
    })

    .configureBabelPresetEnv((config) => {
        config.useBuiltIns = 'usage';
        config.corejs = 3;
    })

    .enableSassLoader()
    .autoProvidejQuery()
;

module.exports = Encore.getWebpackConfig();

When I try use build I have errors

 ERROR  Failed to compile with 6 errors                                                                                                                                                                                                                                           8:03:03 PM

Module build failed: Module not found:
"./web/js/cookies-preferences.js" contains a reference to the file "jquery".
This file can not be found, please check it for typos or update it if the file got moved.

"./web/sites/skins/js/common.js" contains a reference to the file "jquery".
This file can not be found, please check it for typos or update it if the file got moved.

"./web/sites/skins/scss/main.scss.webpack[javascript/auto]!=!./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[4].oneOf[1].use[1]!./node_modules/resolve-url-loader/index.js??ruleSet[1].rules[4].oneOf[1].use[2]!./node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[4].oneOf[1].use[3]!./web/sites/skins/scss/main.scss" contains a reference to the file "/sites/fonts/Geometria/Geometria-Bold.woff2".
This file can not be found, please check it for typos or update it if the file got moved.

"./web/sites/skins/scss/main.scss.webpack[javascript/auto]!=!./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[4].oneOf[1].use[1]!./node_modules/resolve-url-loader/index.js??ruleSet[1].rules[4].oneOf[1].use[2]!./node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[4].oneOf[1].use[3]!./web/sites/skins/scss/main.scss" contains a reference to the file "/sites/fonts/Geometria/Geometria-Bold.woff".
This file can not be found, please check it for typos or update it if the file got moved.

"./web/sites/skins/scss/main.scss.webpack[javascript/auto]!=!./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[4].oneOf[1].use[1]!./node_modules/resolve-url-loader/index.js??ruleSet[1].rules[4].oneOf[1].use[2]!./node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[4].oneOf[1].use[3]!./web/sites/skins/scss/main.scss" contains a reference to the file "/sites/fonts/Geometria/Geometria-Regular.woff2".
This file can not be found, please check it for typos or update it if the file got moved.

"./web/sites/skins/scss/main.scss.webpack[javascript/auto]!=!./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[4].oneOf[1].use[1]!./node_modules/resolve-url-loader/index.js??ruleSet[1].rules[4].oneOf[1].use[2]!./node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[4].oneOf[1].use[3]!./web/sites/skins/scss/main.scss" contains a reference to the file "/sites/fonts/Geometria/Geometria-Regular.woff".
This file can not be found, please check it for typos or update it if the file got moved.

I found same problem symfony/stimulus-bridge#47 but it did not help

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions