s-KaiNet / spfx-fast-serve

Improve your SharePoint Framework development flow by speeding up the "serve" command :rocket:
MIT License
138 stars 11 forks source link

[WDS] Nothing changed #65

Closed alessiosferro closed 2 years ago

alessiosferro commented 2 years ago

Hello!

I am trying to use spfx-fast-serve, I am developing a spfx SPA. When I change the WebPart code the dev server reloads correctly. When I change the code inside the components folder, the reload starts but then says "[WDS] Nothing changed"

The structure of my project is like this: image

Can I have any help on this? I really want this feature to speed up my productivity. Thanks in advance

s-KaiNet commented 2 years ago

Hi,

most likely the component you change is not a part of the bundle, i.e. it's not referenced by any other components or web parts. If you add import ... to include this component into the codebase, it should start reloading.

alessiosferro commented 2 years ago

All components are referenced and imported, it works normally with gulp serve... I use react router and lazy loaded modules.

Inside the render method of the WebPart I am referencing a React component directly imported into the file, if I try to change that it still says "[WDS] Nothing changed"

Edit: I am investigating on a possible solution, there are paths not found inside the Webpart compiled file (I am using aliases)

It seems like my components are not included in the bundle because the webpack aliases are not resolved correctly...

Inside the webpack.extend.js im passing this configuration:

const webpackConfig = {
    plugins: [
        new webpack.DefinePlugin({
            PRODUCTION: process.env.NODE_ENV !== 'DEVELOPMENT'
        })],
    resolve: {
        alias: {
            '@loc': path.resolve(__dirname, '../lib/webparts/mefDocumentale/loc/'),
            '@utility': path.resolve(__dirname, '../lib/webparts/mefDocumentale/utility/'),
            '@assets': path.resolve(__dirname, '../lib/webparts/mefDocumentale/assets/'),
            '@hooks': path.resolve(__dirname, '../lib/webparts/mefDocumentale/hooks/'),
            '@store': path.resolve(__dirname, '../lib/webparts/mefDocumentale/store/'),
            '@data': path.resolve(__dirname, '../lib/webparts/mefDocumentale/data/'),
            '@components': path.resolve(__dirname, '../lib/webparts/mefDocumentale/components/'),
            '@model': path.resolve(__dirname, '../lib/webparts/mefDocumentale/model/')
        }
    },
}
s-KaiNet commented 2 years ago

Please check out this sample config from the advanced solution. For fast-serve you should reference files inside src folder, not lib.

alessiosferro commented 2 years ago

Thank you, it works now!! THANKS!!!!