Coder Social home page Coder Social logo

Comments (9)

rthaut avatar rthaut commented on June 21, 2024 1

@pbek you need to name the file webextension-toolbox.config.js (note the period/dot between "toolbox" and "config"), as defined in the main binary file/script here. With that name you can place it in the root directory and have it picked up automatically.

This appears to be an issue with the documentation; I will work on a PR to get it fixed.

from webextension-toolbox.

onikienko avatar onikienko commented on June 21, 2024
  1. add app/webextension-toolbox-config.js with just one line: const webpack = require('webpack') like described here

@pbek You have to add webextension-toolbox-config.js to the project root. Not into app folder

from webextension-toolbox.

pbek avatar pbek commented on June 21, 2024

Originally (at version 3) I had it in the root directory, but the file gets ignored completely in the root directory in version 4 (see #309 (comment)).

from webextension-toolbox.

pbek avatar pbek commented on June 21, 2024

I just tried again with 4.0.3. The only directory where webextension-toolbox-config.js seems to get recognized is when it is in the app directory. Putting it into the project root (so one level up from app) work out for me.

from webextension-toolbox.

pbek avatar pbek commented on June 21, 2024

Thank you for the hint. The file seems to be recognized now, but with a const webpack = require('webpack') in it (according to the documentation) you will now get 82 errors and 10 warnings, like:

ERROR in ../node_modules/webpack/lib/util/fs.js 8:13-28
Module not found: Error: Can't resolve 'path' in '/home/omega/Test/web-extension/node_modules/webpack/lib/util'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
        - add a fallback 'resolve.fallback: { "path": require.resolve("path-browserify") }'
        - install 'path-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
        resolve.fallback: { "path": false }
 @ ../node_modules/webpack/lib/CleanPlugin.js 12:17-37
 @ ../node_modules/webpack/lib/index.js 141:9-33
 @ ./webextension-toolbox.config.js 1:16-34

ERROR in ../node_modules/webpack/lib/util/identifier.js 7:13-28
Module not found: Error: Can't resolve 'path' in '/home/omega/Test/web-extension/node_modules/webpack/lib/util'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
        - add a fallback 'resolve.fallback: { "path": require.resolve("path-browserify") }'
        - install 'path-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
        resolve.fallback: { "path": false }
 @ ../node_modules/webpack/lib/Compiler.js 33:30-58
 @ ../node_modules/webpack/lib/index.js 147:9-30
 @ ./webextension-toolbox.config.js 1:16-34

ERROR in ../node_modules/webpack/lib/webpack.js 8:13-28
Module not found: Error: Can't resolve 'util' in '/home/omega/Test/web-extension/node_modules/webpack/lib'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
        - add a fallback 'resolve.fallback: { "util": require.resolve("util/") }'
        - install 'util'
If you don't want to include a polyfill, you can use an empty module like this:
        resolve.fallback: { "util": false }
 @ ../node_modules/webpack/lib/index.js 95:30-50 98:9-29
 @ ./webextension-toolbox.config.js 1:16-34

from webextension-toolbox.

onikienko avatar onikienko commented on June 21, 2024

@pbek

I am not sure that it will help, but I do not require webpack const webpack = require('webpack') in my webextension-toolbox.config.js. And it works.

My file looks like:

module.exports = {
    webpack: (config) => {
            // my code here
        return config;
    }
};

from webextension-toolbox.

pbek avatar pbek commented on June 21, 2024

@onikienko, that really helped. Thank you very much!
I needed to drop my:

        config.plugins.push(new webpack.ProvidePlugin({
            Vue: 'vue',
            VueLoader: 'vue-loader'
        }));

But I could use:

const VueLoaderPlugin = require('vue-loader/lib/plugin');

...at the start of webextension-toolbox.config.js.

Seems like https://github.com/webextension-toolbox/webextension-toolbox#customizing-webpack-config needs even more changes.

from webextension-toolbox.

pbek avatar pbek commented on June 21, 2024

I created a PR #515 for the documentation change.

from webextension-toolbox.

tm1000 avatar tm1000 commented on June 21, 2024

Closed from #515

from webextension-toolbox.

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.