惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Simon Willison's Weblog
Simon Willison's Weblog
Help Net Security
Help Net Security
P
Privacy International News Feed
T
Threat Research - Cisco Blogs
C
Cisco Blogs
C
CERT Recently Published Vulnerability Notes
NISL@THU
NISL@THU
L
LINUX DO - 热门话题
Security Latest
Security Latest
A
Arctic Wolf
G
GRAHAM CLULEY
月光博客
月光博客
S
Securelist
D
Docker
J
Java Code Geeks
T
Troy Hunt's Blog
T
Tenable Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
SecWiki News
SecWiki News
S
Security @ Cisco Blogs
量子位
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
L
LINUX DO - 最新话题
Recent Commits to openclaw:main
Recent Commits to openclaw:main
aimingoo的专栏
aimingoo的专栏
博客园 - 【当耐特】
H
Heimdal Security Blog
The Hacker News
The Hacker News
博客园 - 三生石上(FineUI控件)
Application and Cybersecurity Blog
Application and Cybersecurity Blog
N
Netflix TechBlog - Medium
Vercel News
Vercel News
Forbes - Security
Forbes - Security
B
Blog RSS Feed
H
Hackread – Cybersecurity News, Data Breaches, AI and More
IT之家
IT之家
B
Blog
MongoDB | Blog
MongoDB | Blog
博客园 - 聂微东
Google DeepMind News
Google DeepMind News
S
Secure Thoughts
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
C
Check Point Blog
云风的 BLOG
云风的 BLOG
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
T
The Blog of Author Tim Ferriss
L
Lohrmann on Cybersecurity
F
Full Disclosure
D
Darknet – Hacking Tools, Hacker News & Cyber Security
P
Proofpoint News Feed

webpack

[前端] 前后端分离开发过程中,对 session 有依赖,如何优雅处理? - V2EX 如何在编译时检测是否引入开发的代码 - V2EX webpack-dev-server 启动 dev server 后,如何让其它的机器可以访问该 server? - V2EX webpack.config.js 在 exports 配置之前,能先执行一段异步代码到? - V2EX webpack 关于依赖提取的 build 差异 - V2EX webpack 里面 definePlugin 里面定义了一些 process.env 的变量,这个是如何应用到 runtime 环境的? - V2EX webpack 现在依然不能自动支持 tree-shaking,来优化引入的包么? - V2EX webpack5 打包后为何最外层使用的是箭头函数包裹,能否去掉? - V2EX 为什么起个空项目配置 webpack 编译的速度不如 create-react-app 创建的项目快? - V2EX 问下大佬们,webpack 的动态导入怎么实现比较好? - V2EX 你真的理解 Webpack?请回答下列问题。 - V2EX webpack 那么牛逼。如果只是写 vue 的话,只是不是只要 vue cli 就够了。 - V2EX 为什么 vue 项目木打包后必须部署在服务器或本地起一个 web 服务才能运行? - V2EX Webpack 中如何关联 AMD 模块的依赖映射? - V2EX vue 编译后如何嵌入到类似 jsp 老系统中? - V2EX Webpack build 出来的 CSS 内资源路径与 dev-server 调试的时候不一样? - V2EX 不了解 WebAssembly 和 webpack 的关联 webpack 工程化和 vue 单文件组件开发例子项目 - V2EX 关于 webpack 配置多页面之后的热更新问题 - V2EX 关于 webpack-dev-server 的配置问题 - V2EX webpack 的官方 node-loader 是放弃治疗了吗 - V2EX 只编译 Pug 时配置应该怎么写? - V2EX webpack 和 redux 调试问题 - V2EX 关于 webpack 和 ES6 的问题 - V2EX 怎样调试 Webpack 打包好的代码吗? webpack 的 Code Splitting 不支持第三方 css 吗? - V2EX 前端轮子们: gulp 和 webpack 是不是有功能上的 overlap - V2EX gulp 和 webpack 区别 - V2EX Webpack 怎么改 html 中的 js 路径? - V2EX
怎么在 webpack devserver 里 用相对路径 import scss(font-awesome)? - V2EX
eromoe · 2016-06-29 · via webpack

我现在用 webpack devserver 搞个 react 的东西

结构如下

怎么能在 main.scss import 相对路径 的 scss 文件?

@import 'font-awesome/font-awesome.scss'; 一旦写进去, webpack devserver 就开始报错了, 只有放到 index.js 里 import 才行

so 上也有类似问题 http://stackoverflow.com/questions/33649761/how-do-i-load-font-awesome-using-scss-sass-in-webpack-using-relative-paths

没有解决办法

webpack 配置:

const path = require('path');
const webpack = require('webpack');

module.exports = {
  devtool: 'cheap-module-eval-source-map',
  entry: [
    'eventsource-polyfill', // necessary for hot reloading with IE
    'webpack-hot-middleware/client',
    './src/index'
  ],
  output: {
    path: path.join(__dirname, 'dist'),
    filename: 'bundle.js',
    publicPath: '/static/'
  },
  plugins: [
    /**
     * This is where the magic happens! You need this to enable Hot Module Replacement!
     */
    new webpack.HotModuleReplacementPlugin(),
    /**
     * NoErrorsPlugin prevents your webpack CLI from exiting with an error code if
     * there are errors during compiling - essentially, assets that include errors
     * will not be emitted. If you want your webpack to 'fail', you need to check out
     * the bail option.
     */
    new webpack.NoErrorsPlugin(),
    /**
     * DefinePlugin allows us to define free variables, in any webpack build, you can
     * use it to create separate builds with debug logging or adding global constants!
     * Here, we use it to specify a development build.
     */
    new webpack.DefinePlugin({
      'process.env.NODE_ENV': JSON.stringify('development')
    }),
  ],
  module: {
    loaders: [
      {
        test: /\.js?/,
        exclude: [/node_modules/, /styles/],
        loaders: ['babel'],
        include: path.join(__dirname, 'src')
      },
      {
        test: /\.scss$/,
        loader: 'style!css!sass'
      },
      {
        test: /\.css$/,
        loader: "style-loader!css-loader"
      },
      {
        test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/,
        loader: 'url-loader?limit=10000&mimetype=application/font-woff'
      },
      {
        test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
        loader: 'file-loader'
      }
    ]
  }
};

我只懂基本的webpack配置, 尝试了下改 entry 和output 都没啥用。。。