GET http:// localhost:8080 / static / css / 1.e8747c0d.chunk.css net :: ERR_ABORTED 404

时间:2019-01-28 06:12:41

标签: css reactjs spring-boot

我可以引用index.html,但不能引用诸如CSS和JS之类的静态内容

<build>
    <finalName>LoginAndRegistration</finalName>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
        <plugin>
            <groupId>com.github.eirslett</groupId>
            <artifactId>frontend-maven-plugin</artifactId>
            <version>1.6</version>
            <configuration>
                <workingDirectory>frontend</workingDirectory>
                <installDirectory>target</installDirectory>
            </configuration>
            <executions>
                <execution>
                    <id>install node and npm</id>
                    <goals>
                        <goal>install-node-and-npm</goal>
                    </goals>
                    <configuration>
                        <nodeVersion>v10.15.0</nodeVersion>
                        <npmVersion>6.4.0</npmVersion>
                    </configuration>
                </execution>
                <execution>
                    <id>npm install</id>
                    <goals>
                        <goal>npm</goal>
                    </goals>
                    <configuration>
                        <arguments>install</arguments>
                    </configuration>
                </execution>
                <execution>
                    <id>npm run build</id>
                    <goals>
                        <goal>npm</goal>
                    </goals>
                    <configuration>
                        <arguments>run build</arguments>
                    </configuration>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <artifactId>maven-antrun-plugin</artifactId>
            <executions>
                <execution>
                    <phase>generate-resources</phase>
                    <configuration>
                        <target>
                            <copy todir="${basedir}/target/classes/resources">
                                <filesetdir="${project.basedir}/frontend/build"/>
                            </copy>
                        </target>
                    </configuration>
                    <goals>
                        <goal>run</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

我尝试了添加<copy todir="${basedir}/target/classes/resources">的许多组合,例如公共,静态,资源等,似乎没有任何效果。

我可以使用http://localhost:8080/LoginAndRegistration/引用index.html,但是它没有加载CSS和javascript

0 个答案:

没有答案